Hi there,
I’m really stuck on one part of the assignment, specifically cell UNQ_C5.
My problem is with the very last part, which runs the encoder multiple times using a for loop.
There are a couple of things I don’t understand about how the code is written:
- self.enc_layers, defined in the init section as
self.enc_layers = [EncoderLayer(embedding_dim=self.embedding_dim,
num_heads=num_heads,
fully_connected_dim=fully_connected_dim,
dropout_rate=dropout_rate,
layernorm_eps=layernorm_eps)
for _ in range(self.num_layers)]
appears to generate a list by iterating the encoder (self.num_layers) times - so why do you need the for loop towards the bottom of the function body?
- In the comments, it says that the function returns:
Returns:
out2 – Tensor of shape (batch_size, input_seq_len, embedding_dim)
but the function code as written returns x (which has a different size).
Thanks for your help!
Joe