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
Getting the following error , when trying to run vae.train
`
TypeError: in user code:
File "C:\Users\arind\anaconda3\envs\tf\lib\site-packages\keras\engine\training.py", line 1051, in train_function *
return step_function(self, iterator)
File "C:\Users\arind\anaconda3\envs\tf\lib\site-packages\keras\engine\training.py", line 1040, in step_function **
outputs = model.distribute_strategy.run(run_step, args=(data,))
File "C:\Users\arind\anaconda3\envs\tf\lib\site-packages\keras\engine\training.py", line 1030, in run_step **
outputs = model.train_step(data)
File "C:\Users\arind\anaconda3\envs\tf\lib\site-packages\keras\engine\training.py", line 890, in train_step
loss = self.compute_loss(x, y, y_pred, sample_weight)
File "C:\Users\arind\anaconda3\envs\tf\lib\site-packages\keras\engine\training.py", line 948, in compute_loss
return self.compiled_loss(
File "C:\Users\arind\anaconda3\envs\tf\lib\site-packages\keras\engine\compile_utils.py", line 239, in __call__
self._loss_metric.update_state(
File "C:\Users\arind\anaconda3\envs\tf\lib\site-packages\keras\utils\metrics_utils.py", line 70, in decorated
update_op = update_state_fn(*args, **kwargs)
File "C:\Users\arind\anaconda3\envs\tf\lib\site-packages\keras\metrics\base_metric.py", line 140, in update_state_fn
return ag_update_state(*args, **kwargs)
File "C:\Users\arind\anaconda3\envs\tf\lib\site-packages\keras\metrics\base_metric.py", line 449, in update_state **
sample_weight = tf.__internal__.ops.broadcast_weights(
File "C:\Users\arind\anaconda3\envs\tf\lib\site-packages\keras\engine\keras_tensor.py", line 254, in __array__
raise TypeError(
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, 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.
` Edit-1 25-Aug-22
I am certain that the error is coming from the custom KL Loss function. In the compile method , if I use only the vae_r_loss, the code works
Getting the following error , when trying to run vae.train
`
TypeError: in user code:
`
Edit-1 25-Aug-22
I am certain that the error is coming from the custom KL Loss function. In the compile method , if I use only the vae_r_loss, the code works
`
def vae_r_loss(y_true, y_pred):
r_loss = K.mean(K.square(y_true - y_pred), axis = [1,2,3])
return r_loss_factor * r_loss
`
The text was updated successfully, but these errors were encountered: