Closed Aaronng1223 closed 1 year ago
please try disabling eager execution of tensorflow:
from tensorflow.python.framework.ops import disable_eager_execution disable_eager_execution()
Disable eager execution inside this program? May I know what is the reason.
closing as the error has a straight-forward solution.
Hi, I am newbie to training model using machine learning algorithms. I am using Tensorflow 2.11 and python 3.10 but I got error while I am trying to execute the program. Could you help me to solve the error?
Error typeerror: you are passing kerastensor(type_spec=tensorspec(shape=(), dtype=tf.float32, name=none), name='placeholder:0', description="created by layer 'tf.cast_2'"), 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 keras inputs/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.