Errors may have originated from an input operation.系输入错误

Traceback (most recent call last):
  File "/home/dutxutengfei/vae-gan/vaer_gan_z2.py", line 528, in <module>
    VAER_GAN_instance.fit(parsed_image_dataset,epochs=epochs,callbacks=[MyPlotCallback_test(VAER_GAN_instance,a128batch),MyepochsaveCallback(save_dir,VAER_GAN_instance)])
  File "/home/dutxutengfei/anaconda3/envs/tensorflowpython37/lib/python3.7/site-packages/keras/engine/training.py", line 1184, in fit
    tmp_logs = self.train_function(iterator)
  File "/home/dutxutengfei/anaconda3/envs/tensorflowpython37/lib/python3.7/site-packages/tensorflow/python/eager/def_function.py", line 885, in __call__
    result = self._call(*args, **kwds)
  File "/home/dutxutengfei/anaconda3/envs/tensorflowpython37/lib/python3.7/site-packages/tensorflow/python/eager/def_function.py", line 950, in _call
    return self._stateless_fn(*args, **kwds)
  File "/home/dutxutengfei/anaconda3/envs/tensorflowpython37/lib/python3.7/site-packages/tensorflow/python/eager/function.py", line 3040, in __call__
    filtered_flat_args, captured_inputs=graph_function.captured_inputs)  # pylint: disable=protected-access
  File "/home/dutxutengfei/anaconda3/envs/tensorflowpython37/lib/python3.7/site-packages/tensorflow/python/eager/function.py", line 1964, in _call_flat
    ctx, args, cancellation_manager=cancellation_manager))
  File "/home/dutxutengfei/anaconda3/envs/tensorflowpython37/lib/python3.7/site-packages/tensorflow/python/eager/function.py", line 596, in call
    ctx=ctx)
  File "/home/dutxutengfei/anaconda3/envs/tensorflowpython37/lib/python3.7/site-packages/tensorflow/python/eager/execute.py", line 60, in quick_execute
    inputs, attrs, num_outputs)
tensorflow.python.framework.errors_impl.InvalidArgumentError:  required broadcastable shapes
         [[node sub_3 (defined at /vae-gan/vaer_gan_z2.py:430) ]] [Op:__inference_train_function_8172]

Errors may have originated from an input operation.
Input Source operations connected to node sub_3:
 Reshape_3 (defined at /vae-gan/vaer_gan_z2.py:429)
 Reshape_2 (defined at /vae-gan/vaer_gan_z2.py:428)

Function call stack:
train_function

tensorflow.python.framework.errors_impl.InvalidArgumentError:  required broadcastable shapes

Errors may have originated from an input operation.

查找代码发现是对
vaer_gan_z2.py:430行所在函数reconstructed_loss的使用中,错误输入参数。
但是后来发现,似乎改正了这个问题后仍然会报这样的错。
我调整了tfrecord的batch_size后问题解决,但不敢保证是不是以后不会报错了

猜你喜欢

转载自blog.csdn.net/qq_44065334/article/details/120468952
今日推荐