I’m getting the Assertion error below. I completed the following steps:
- pass x through the embedding layer using self.embedding(x)
- Scale x by using *= tf.math.sqrt() (using tf.cast() on self.embedding_dim
- Add the PE as directed in the instructions
- For the dropout layer I used self.dropout() with training=training
- In the for … loop I called self.enc_layers[i]
But I’m getting this error:
AssertionError Traceback (most recent call last)
in
1 # UNIT TEST
----> 2 Encoder_test(Encoder)
~/work/W4A1/public_tests.py in Encoder_test(target)
116 encoderq_output = encoderq(x, True, None)
117
→ 118 assert tf.is_tensor(encoderq_output), “Wrong type. Output must be a tensor”
119 assert tuple(tf.shape(encoderq_output).numpy()) == (x.shape[0], x.shape[1], embedding_dim), f"Wrong shape. We expected ({x.shape[0]}, {x.shape[1]}, {embedding_dim})"
120 assert np.allclose(encoderq_output.numpy(),
AssertionError: Wrong type. Output must be a tensor