Typo in Week's assignment notebook

Currently, there is a typo in the following cell.

# Pretend the embedding matrix uses 
# 2 features for embedding the meaning of a word
# and you have a sentence of 3 words
# So the output of the embedding layer has shape (3,2), (sentence length, d_feature)
tmp_embeded = np.array([[1,2],
                        [3,4],
                        [5,6]])

# take the mean along axis 0
print("The mean along axis 0 creates a vector whose length equals the number of features in a word embedding")
display(np.mean(tmp_embed,axis=0))

print("The mean along axis 1 creates a vector whose length equals the number of words in a sentence")
display(np.mean(tmp_embed,axis=1))

It tries to calculate the mean on the “tmp_embed” variable but that is a trax.layers.core.Embedding object which generates the following error:

TypeError: mean requires ndarray or scalar arguments, got <class 'trax.layers.core.Embedding'> at position 0.

Instead of “tmp_embed” the correct variable’s name should be “tmp_embeded”.

Hey @Luis_Talavera,
Thanks a lot for your feedback. I have raised an issue regarding this, and it will be fixed as soon as possible.

Cheers,
Elemento

1 Like