reading the instruction, what is the meaning is step 3 of self.pos_encoding [:, :seq_len, :]
t
in particular, [:, :seq_len, :]
Exercise 5 - Encoder
Complete the
Encoder()
function using thecall()
method to embed your input, add positional encoding, and implement multiple encoder layers.In this exercise, you will initialize your Encoder with an Embedding layer, positional encoding, and multiple EncoderLayers. Your
call()
method will perform the following steps:
- Pass your input through the Embedding layer.
- Scale your embedding by multiplying it by the square root of your embedding dimension. Remember to cast the embedding dimension to data type
tf.float32
before computing the square root.- Add the position encoding: self.pos_encoding
[:, :seq_len, :]
to your embedding.