C3 W1 -->Error in cell 47:
Expected output
Model: "grulm"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
embedding (Embedding) (None, 100, 256) 20992
gru (GRU) [(None, 100, 512), 1182720
(None, 512)]
dense (Dense) (None, 100, 82) 42066
=================================================================
Total params: 1245778 (4.75 MB)
Trainable params: 1245778 (4.75 MB)
Non-trainable params: 0 (0.00 Byte)
_________________________________________________________________
Error:
Traceback (most recent call last):
File “/usr/local/lib/python3.8/dist-packages/keras/src/engine/training.py”, line 521, in build
self.call(x, **kwargs)
File “/tmp/ipykernel_14/3772264745.py”, line 35, in call
x, states = self.gru(x, initial_state=states, training=training)
File “/usr/local/lib/python3.8/dist-packages/tensorflow/python/framework/ops.py”, line 528, in iter
self._disallow_iteration()
File “/usr/local/lib/python3.8/dist-packages/tensorflow/python/framework/ops.py”, line 524, in _disallow_iteration
self._disallow_in_graph_mode(“Iterating over a symbolic tf.Tensor
”)
File “/usr/local/lib/python3.8/dist-packages/tensorflow/python/framework/ops.py”, line 493, in _disallow_in_graph_mode
raise errors.OperatorNotAllowedInGraphError(
tensorflow.python.framework.errors_impl.OperatorNotAllowedInGraphError: Iterating over a symbolic tf.Tensor
is not allowed in Graph execution. Use Eager execution or decorate this function with @tf.function.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/tmp/ipykernel_14/936901248.py”, line 5, in
model.build(input_shape=(BATCH_SIZE, 100))
File “/usr/local/lib/python3.8/dist-packages/keras/src/engine/training.py”, line 523, in build
raise ValueError(
ValueError: You cannot build your model by calling build
if your layers do not support float type inputs. Instead, in order to instantiate and build your model, call your model on real tensor data (of the correct dtype).
The actual error from call
is: Iterating over a symbolic tf.Tensor
is not allowed in Graph execution. Use Eager execution or decorate this function with @tf.function…
None of the default values were changed.