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
ValueError: Tried to convert 'x' to a tensor and failed. Error: A KerasTensor cannot be used as input to a TensorFlow function. A KerasTensor is a symbolic placeholder for a shape and dtype, used when constructing Keras Functional models or Keras Functions. You can only use it as input to a Keras layer or a Keras operation (from the namespaces keras.layers and keras.operations). You are likely doing something like:
x = Input(...)
...
tf_fn(x) # Invalid.
What you should do instead is wrap tf_fn in a layer:
class MyLayer(Layer):
def call(self, x):
return tf_fn(x)
x = MyLayer()(x)
My code is: %run -i ./MODEL_TRAININGS/Run_VAE_Models.py PANCREAS 5 0 100
TensorFlow version: 2.18.0
Keras version: 3.7.0
Wondering if you could provide some instructions on how to solve it. Thank you in advance!
The text was updated successfully, but these errors were encountered:
Hi, thank you for the great work. I was using the pancreas dataset you provided to run and learn the model.
However, in step 2, I came across this error:
---> 63 kl_loss = - 0.5 * K.sum(1 + z_log_var - K.square(z_mean) - K.exp(z_log_var), axis=-1)
65 return K.mean(reconstruction_loss + (K.get_value(beta) * kl_loss))
ValueError: Tried to convert 'x' to a tensor and failed. Error: A KerasTensor cannot be used as input to a TensorFlow function. A KerasTensor is a symbolic placeholder for a shape and dtype, used when constructing Keras Functional models or Keras Functions. You can only use it as input to a Keras layer or a Keras operation (from the namespaces
keras.layers
andkeras.operations
). You are likely doing something like:What you should do instead is wrap
tf_fn
in a layer:My code is: %run -i ./MODEL_TRAININGS/Run_VAE_Models.py PANCREAS 5 0 100
TensorFlow version: 2.18.0
Keras version: 3.7.0
Wondering if you could provide some instructions on how to solve it. Thank you in advance!
The text was updated successfully, but these errors were encountered: