C5w4 The final transformer code exercise 8

In the transformer function where everything is put together, we invoke the call function for both the encoder and decoder block using encoder(…) and decoder(…). Can anyone tell me the logic behind why this works and why we don’t instead invoke the encoder.call() function? Is call supposed to be a built in class method ? from my understanding built in methods follow the (underscore)(underscore)method(underscore)(underscore) format

Remember we use subclassing. Also, __call__ invokes call:

1 Like