Hi,
I am reimplementing your acgan code for a different X-ray dataset and got the following error.
Could you please help to resolve this issue? Meanwhile, I am compiling the whole code in a single file acgan.py
Much appreciated.
Error log:
Traceback (most recent call last):
File "acgan.py", line 288, in
epoch_disc_loss.append(dis.train_on_batch(X, [y, aux_y]))
File "/cm/shared/apps/tensorflow2-py37-cuda10.1-gcc/2.2.0/lib/python3.7/site-packages/tensorflow/python/keras/engine/training.py", line 1348, in train_on_batch
logs = train_function(iterator)
File "/cm/shared/apps/tensorflow2-py37-cuda10.1-gcc/2.2.0/lib/python3.7/site-packages/tensorflow/python/eager/def_function.py", line 580, in call
result = self._call(*args, **kwds)
File "/cm/shared/apps/tensorflow2-py37-cuda10.1-gcc/2.2.0/lib/python3.7/site-packages/tensorflow/python/eager/def_function.py", line 611, in _call
return self._stateless_fn(*args, **kwds) # pylint: disable=not-callable
File "/cm/shared/apps/tensorflow2-py37-cuda10.1-gcc/2.2.0/lib/python3.7/site-packages/tensorflow/python/eager/function.py", line 2419, in call
graph_function, args, kwargs = self._maybe_define_function(args, kwargs)
File "/cm/shared/apps/tensorflow2-py37-cuda10.1-gcc/2.2.0/lib/python3.7/site-packages/tensorflow/python/eager/function.py", line 2774, in _maybe_define_function
return self._define_function_with_shape_relaxation(args, kwargs)
File "/cm/shared/apps/tensorflow2-py37-cuda10.1-gcc/2.2.0/lib/python3.7/site-packages/tensorflow/python/eager/function.py", line 2706, in _define_function_with_shape$
args, kwargs, override_flat_arg_shapes=relaxed_arg_shapes)
File "/cm/shared/apps/tensorflow2-py37-cuda10.1-gcc/2.2.0/lib/python3.7/site-packages/tensorflow/python/eager/function.py", line 2667, in _create_graph_function
capture_by_value=self._capture_by_value),
File "/cm/shared/apps/tensorflow2-py37-cuda10.1-gcc/2.2.0/lib/python3.7/site-packages/tensorflow/python/framework/func_graph.py", line 981, in func_graph_from_py_func
func_outputs = python_func(*func_args, **func_kwargs)
File "/cm/shared/apps/tensorflow2-py37-cuda10.1-gcc/2.2.0/lib/python3.7/site-packages/tensorflow/python/eager/def_function.py", line 441, in wrapped_fn
return weak_wrapped_fn().wrapped(*args, **kwds)
File "/cm/shared/apps/tensorflow2-py37-cuda10.1-gcc/2.2.0/lib/python3.7/site-packages/tensorflow/python/framework/func_graph.py", line 968, in wrapper
raise e.ag_error_metadata.to_exception(e)
ValueError: in user code:
/cm/shared/apps/tensorflow2-py37-cuda10.1-gcc/2.2.0/lib/python3.7/site-packages/tensorflow/python/keras/engine/training.py:571 train_function *
outputs = self.distribute_strategy.run(
/cm/shared/apps/tensorflow2-py37-cuda10.1-gcc/2.2.0/lib/python3.7/site-packages/tensorflow/python/distribute/distribute_lib.py:951 run **
return self._extended.call_for_each_replica(fn, args=args, kwargs=kwargs)
/cm/shared/apps/tensorflow2-py37-cuda10.1-gcc/2.2.0/lib/python3.7/site-packages/tensorflow/python/distribute/distribute_lib.py:2290 call_for_each_replica
return self._call_for_each_replica(fn, args, kwargs)
/cm/shared/apps/tensorflow2-py37-cuda10.1-gcc/2.2.0/lib/python3.7/site-packages/tensorflow/python/distribute/distribute_lib.py:2649 _call_for_each_replica
return fn(*args, **kwargs)
/cm/shared/apps/tensorflow2-py37-cuda10.1-gcc/2.2.0/lib/python3.7/site-packages/tensorflow/python/keras/engine/training.py:533 train_step **
y, y_pred, sample_weight, regularization_losses=self.losses)
/cm/shared/apps/tensorflow2-py37-cuda10.1-gcc/2.2.0/lib/python3.7/site-packages/tensorflow/python/keras/engine/compile_utils.py:205 __call__
loss_value = loss_obj(y_t, y_p, sample_weight=sw)
/cm/shared/apps/tensorflow2-py37-cuda10.1-gcc/2.2.0/lib/python3.7/site-packages/tensorflow/python/keras/losses.py:143 __call__
losses = self.call(y_true, y_pred)
/cm/shared/apps/tensorflow2-py37-cuda10.1-gcc/2.2.0/lib/python3.7/site-packages/tensorflow/python/keras/losses.py:246 call
return self.fn(y_true, y_pred, **self._fn_kwargs)
/cm/shared/apps/tensorflow2-py37-cuda10.1-gcc/2.2.0/lib/python3.7/site-packages/tensorflow/python/keras/losses.py:1595 binary_crossentropy
K.binary_crossentropy(y_true, y_pred, from_logits=from_logits), axis=-1)
/cm/shared/apps/tensorflow2-py37-cuda10.1-gcc/2.2.0/lib/python3.7/site-packages/tensorflow/python/keras/backend.py:4692 binary_crossentropy
return nn.sigmoid_cross_entropy_with_logits(labels=target, logits=output)
/cm/shared/apps/tensorflow2-py37-cuda10.1-gcc/2.2.0/lib/python3.7/site-packages/tensorflow/python/ops/nn_impl.py:172 sigmoid_cross_entropy_with_logits
(logits.get_shape(), labels.get_shape()))
ValueError: logits and labels must have the same shape ((50, 1) vs (72, 1))