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

Problem with the code of VAE in main.py #10

Open
Yuxing0926 opened this issue Jun 28, 2022 · 2 comments
Open

Problem with the code of VAE in main.py #10

Yuxing0926 opened this issue Jun 28, 2022 · 2 comments

Comments

@Yuxing0926
Copy link

Traceback (most recent call last):
File "/Users/mayuxing/Downloads/FTCP-master 2/main.py", line 55, in
VAE.fit([X_train, y_train],
File "/Users/mayuxing/opt/anaconda3/lib/python3.9/site-packages/keras/utils/traceback_utils.py", line 67, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/var/folders/pr/t7phtfp9055f_v4lkb49g73c0000gn/T/autograph_generated_file32azsqjs.py", line 15, in tf__train_function
retval
= ag
_.converted_call(ag__.ld(step_function), (ag__.ld(self), ag__.ld(iterator)), None, fscope)
TypeError: in user code:

File "/Users/mayuxing/opt/anaconda3/lib/python3.9/site-packages/keras/engine/training.py", line 1051, in train_function  *
    return step_function(self, iterator)
File "/Users/mayuxing/opt/anaconda3/lib/python3.9/site-packages/keras/engine/training.py", line 1040, in step_function  **
    outputs = model.distribute_strategy.run(run_step, args=(data,))
File "/Users/mayuxing/opt/anaconda3/lib/python3.9/site-packages/keras/engine/training.py", line 1030, in run_step  **
    outputs = model.train_step(data)
File "/Users/mayuxing/opt/anaconda3/lib/python3.9/site-packages/keras/engine/training.py", line 890, in train_step
    loss = self.compute_loss(x, y, y_pred, sample_weight)
File "/Users/mayuxing/opt/anaconda3/lib/python3.9/site-packages/keras/engine/training.py", line 948, in compute_loss
    return self.compiled_loss(
File "/Users/mayuxing/opt/anaconda3/lib/python3.9/site-packages/keras/engine/compile_utils.py", line 239, in __call__
    self._loss_metric.update_state(
File "/Users/mayuxing/opt/anaconda3/lib/python3.9/site-packages/keras/utils/metrics_utils.py", line 70, in decorated
    update_op = update_state_fn(*args, **kwargs)
File "/Users/mayuxing/opt/anaconda3/lib/python3.9/site-packages/keras/metrics/base_metric.py", line 140, in update_state_fn
    return ag_update_state(*args, **kwargs)
File "/Users/mayuxing/opt/anaconda3/lib/python3.9/site-packages/keras/metrics/base_metric.py", line 449, in update_state  **
    sample_weight = tf.__internal__.ops.broadcast_weights(
File "/Users/mayuxing/opt/anaconda3/lib/python3.9/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.

I dont know how to debug this. Look forward to you answer. :)

@sgbaird
Copy link
Contributor

sgbaird commented Jun 28, 2022

@469900626 maybe give the notebook mentioned here a try (make sure it runs to completion), and then swap the existing data with your data?

Also, a reproducer would probably help the devs to debug this.

@Yuxing0926
Copy link
Author

Thanks for your reply! :)

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

2 participants