【发布时间】:2021-01-29 07:24:58
【问题描述】:
我正在 Google Colab 上从事与 GAN 相关的 .ipynb 项目。首先我得到了错误
AttributeError: module 'tensorflow' has no attribute 'log' 我将 tf.log 切换到 tf.math.log 来修复它,但遇到了以下问题。会不会是版本问题?我认为这不是我的代码造成的。
<ipython-input-54-3d3644f6e96d> in <module>()
1
----> 2 train(d_model, g_model, gan_model, [blue_sketch, blue_photo], 'Models/Pixel[02]_Context[08]/', n_epochs = 100, n_batch=16)
3 frames
<ipython-input-53-b838163ed04b> in train(d_model, g_model, gan_model, data, target_dir, n_epochs, n_batch)
33
34 # update the generator
---> 35 g_loss, _, _ = gan_model.train_on_batch(X_realA, [y_real, X_realB])
36
37 # summarize performance
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py in train_on_batch(self, x, y, sample_weight, class_weight, reset_metrics, return_dict)
1725 class_weight)
1726 self.train_function = self.make_train_function()
-> 1727 logs = self.train_function(iterator)
1728
1729 if reset_metrics:
/usr/local/lib/python3.6/dist-packages/tensorflow/python/eager/def_function.py in __call__(self, *args, **kwds)
826 tracing_count = self.experimental_get_tracing_count()
827 with trace.Trace(self._name) as tm:
--> 828 result = self._call(*args, **kwds)
829 compiler = "xla" if self._experimental_compile else "nonXla"
830 new_tracing_count = self.experimental_get_tracing_count()
/usr/local/lib/python3.6/dist-packages/tensorflow/python/eager/def_function.py in _call(self, *args, **kwds)
853 # In this case we have created variables on the first call, so we run the
854 # defunned version which is guaranteed to never create variables.
--> 855 return self._stateless_fn(*args, **kwds) # pylint: disable=not-callable
856 elif self._stateful_fn is not None:
857 # Release the lock early so that multiple threads can perform the call
TypeError: 'NoneType' object is not callable
【问题讨论】:
标签: python tensorflow keras training-data generative-adversarial-network