Open TongbaoYang opened 2 years ago
Did you use the tensorflow 2 to run the script?
Did you use the tensorflow 2 to run the script?
I use 1.15.x to run this train.py script. It's fine when run with defuat configure, but throw the error when specific 'wgan-gp' as the running gan.
Sorry, I didn't try the 'wgan-gp'. Can't help.
File "/hy-tmp/AnimeGANv2-master/AnimeGANv2.py", line 125, in gradientpanalty logit, = self.discriminator(interpolated, reuse=True, scope=scope) refer to it to modify.
I have the same problem with dragan, wgan-lp and wgan-gp. gan, lsgan and hinge are working. Does anybody know how to fix this?
Traceback (most recent call last):
File "train.py", line 103, in <module>
main()
File "train.py", line 93, in main
gan.build_model()
File "/home/.../Documents/masterthesis/repos/AnimeGANv2/AnimeGANv2.py", line 144, in build_model
GP = self.gradient_panalty(real=self.anime, fake=self.generated)
File "/home/.../Documents/masterthesis/repos/AnimeGANv2/AnimeGANv2.py", line 114, in gradient_panalty
logit, _= self.discriminator(interpolated, reuse=True, scope=scope)
File "/home/.../anaconda3/envs/AnimeGAN/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py", line 547, in __iter__
self._disallow_iteration()
File "/home/.../anaconda3/envs/AnimeGAN/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py", line 543, in _disallow_iteration
self._disallow_in_graph_mode("iterating over `tf.Tensor`")
File "/home/.../anaconda3/envs/AnimeGAN/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py", line 523, in _disallow_in_graph_mode
" this function with @tf.function.".format(task))
tensorflow.python.framework.errors_impl.OperatorNotAllowedInGraphError: iterating over `tf.Tensor` is not allowed in Graph execution. Use Eager execution or decorate this function with @tf.function.
A OperatorNotAllowedInGraphError throw out when I train AnimeGAN, witch I choose 'wgan-gp' as the defualt training gan. Exception trace log as follows:
I'm not familiar with tensorflow 1.x, does any body can help fix this issus.