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
I am trying to run the code for the deep dream and I disable the eager execution to user the gradients. However I got this error:
TypeError Traceback (most recent call last) in <cell line: 8>()
6
7 # Compute the gradients of the dream with regard to the loss.
----> 8 grads = K.gradients(loss, dream)[0]
9 #grads = K.gradients(loss, model.input)[0]
10
14 frames /usr/local/lib/python3.10/dist-packages/keras/src/engine/keras_tensor.py in array(self, dtype)
283
284 def array(self, dtype=None):
--> 285 raise TypeError(
286 f"You are passing {self}, an intermediate Keras symbolic "
287 "input/output, to a TF API that does not allow registering custom "
TypeError: You are passing KerasTensor(type_spec=TensorSpec(shape=(), dtype=tf.float32, name=None), name='tf.operators.add_3/AddV2:0', description="created by layer 'tf.operators.add_3'"), an intermediate Keras symbolic input/output, to a TF API that does not allow registering custom dispatchers, such as tf.cond, tf.function, gradient tapes, or tf.map_fn. Keras Functional model construction only supports TF API calls that do support dispatching, such as tf.math.add or tf.reshape. Other APIs cannot be called directly on symbolic Kerasinputs/outputs. You can work around this limitation by putting the operation in a custom Keras layer call and calling that layer on this symbolic input/output.
The text was updated successfully, but these errors were encountered:
moghalis
changed the title
Chapter 8 Deep Dream issu
Chapter 8 Deep Dream issue
Sep 14, 2023
I am trying to run the code for the deep dream and I disable the eager execution to user the gradients. However I got this error:
TypeError Traceback (most recent call last)
in <cell line: 8>()
6
7 # Compute the gradients of the dream with regard to the loss.
----> 8 grads = K.gradients(loss, dream)[0]
9 #grads = K.gradients(loss, model.input)[0]
10
14 frames
/usr/local/lib/python3.10/dist-packages/keras/src/engine/keras_tensor.py in array(self, dtype)
283
284 def array(self, dtype=None):
--> 285 raise TypeError(
286 f"You are passing {self}, an intermediate Keras symbolic "
287 "input/output, to a TF API that does not allow registering custom "
TypeError: You are passing KerasTensor(type_spec=TensorSpec(shape=(), dtype=tf.float32, name=None), name='tf.operators.add_3/AddV2:0', description="created by layer 'tf.operators.add_3'"), an intermediate Keras symbolic input/output, to a TF API that does not allow registering custom dispatchers, such as
tf.cond
,tf.function
, gradient tapes, ortf.map_fn
. Keras Functional model construction only supports TF API calls that do support dispatching, such astf.math.add
ortf.reshape
. Other APIs cannot be called directly on symbolic Kerasinputs/outputs. You can work around this limitation by putting the operation in a custom Keras layercall
and calling that layer on this symbolic input/output.The text was updated successfully, but these errors were encountered: