Hi,
I’m using the following:
self_mha_output = self.mha(query = x, key = x, value = x, attention_mask = mask)(x)
But I see the error below:
Any help is appreciated - been stuck for a long time!
Thanks!
Hi,
I’m using the following:
self_mha_output = self.mha(query = x, key = x, value = x, attention_mask = mask)(x)
But I see the error below:
Any help is appreciated - been stuck for a long time!
Thanks!
In EncoderLayer(), you’re only defining the layer. So you do not need to provide the (x) data argument. Just leave that off.
Thanks a lot, this worked!
I’m facing a different error in the cell after that though, for the Encoder layer itself:
I’m using tf.math.sqrt in
x *= tf.math.sqrt(self.embedding_dim)
But this seems to be causing an issue. I’ve tried using tf.cast for self.embedding_dim (this causes an error in the following line of code), tf.keras.backend.sqrt instead of tf.math.sqrt, and np.sqrt, none of which work. Could you give me some suggestions?