Closed AlanZ1993 closed 4 years ago
Hi there,
I just tried running with mode lsgan
and found the problem.
The solution is, converting the list generator to a real list in https://github.com/csmliu/STGAN/blob/42d7559b9496df77d9d5e29d1863c5821d1a0e9f/models.py#L148, and the modified code is
_, variance = tf.nn.moments(a, list(range(a.shape.ndims)))
By the way, if you want to use the raw version of LSGAN, you need to remove the GP item.
OMG,it works,thank you so much!
18004306645 | |
---|---|
邮箱:18004306645@163.com |
Signature is customized by Netease Mail Master
On 04/19/2020 18:34, Ming Liu wrote:
Closed #35.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Thanks for your excellent work which helps me l lot! Recently,I want to use mode of lsgan or dcgan to train,but the code has something wrong.Could you please help me how to solve it? Thank you very much.
Traceback (most recent call last): File "train.py", line 205, in
gp = models.gradient_penalty(D, xa)
File "/home/dell/STGAN-master/models.py", line 157, in gradient_penalty
x = _interpolate(real, fake)
File "/home/dell/STGAN-master/models.py", line 148, in interpolate
, variance = tf.nn.moments(a, range(a.shape.ndims))
File "/home/dell/anaconda3/envs/test/lib/python3.6/site-packages/tensorflow/python/ops/nn_impl.py", line 1028, in moments
mean = math_ops.reduce_mean(y, axes, keepdims=True, name="mean")
File "/home/dell/anaconda3/envs/test/lib/python3.6/site-packages/tensorflow/python/util/dispatch.py", line 180, in wrapper
return target(*args, **kwargs)
File "/home/dell/anaconda3/envs/test/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 1764, in reduce_mean
name=name))
File "/home/dell/anaconda3/envs/test/lib/python3.6/site-packages/tensorflow/python/ops/gen_math_ops.py", line 6180, in mean
name=name)
File "/home/dell/anaconda3/envs/test/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 545, in _apply_op_helper
(input_name, err))
ValueError: Tried to convert 'reduction_indices' to a tensor and failed. Error: Argument must be a dense tensor: range(0, 4) - got shape [4], but wanted [].