Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 8 Deep Dream issue #228

Open
moghalis opened this issue Sep 14, 2023 · 0 comments
Open

Chapter 8 Deep Dream issue #228

moghalis opened this issue Sep 14, 2023 · 0 comments

Comments

@moghalis
Copy link

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.

@moghalis moghalis changed the title Chapter 8 Deep Dream issu Chapter 8 Deep Dream issue Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant