You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ValueError Traceback (most recent call last)
[<ipython-input-10-cf8901b39907>](https://localhost:8080/#) in <cell line: 6>()
4
5 encoder_inputs = keras.Input(shape=(None,), dtype="int64", name="encoder_inputs")
----> 6 x = PositionalEmbedding(sequence_length, vocab_size, embed_dim)(encoder_inputs)
7 encoder_outputs = TransformerEncoder(embed_dim, latent_dim, num_heads)(x)
8 encoder = keras.Model(encoder_inputs, encoder_outputs)
1 frames
[<ipython-input-9-23371d180913>](https://localhost:8080/#) in compute_mask(self, inputs, mask)
57
58 def compute_mask(self, inputs, mask=None):
---> 59 return tf.math.not_equal(inputs, 0)
60
61 def get_config(self):
ValueError: A KerasTensor cannot be used as input to a TensorFlow function. A KerasTensor is a symbolic placeholder for a shape and dtype, used when constructing Keras Functional models or Keras Functions. You can only use it as input to a Keras layer or a Keras operation (from the namespaces `keras.layers` and `keras.operations`). You are likely doing something like:
x = Input(...)
...
tf_fn(x) # Invalid.
What you should do instead is wrap `tf_fn`in a layer:
class MyLayer(Layer):
def call(self, x):
return tf_fn(x)
x = MyLayer()(x)
The text was updated successfully, but these errors were encountered:
Error thrown at
Stacktrace
The text was updated successfully, but these errors were encountered: