Open happsky opened 7 years ago
According to https://www.tensorflow.org/api_docs/python/tf/concat concatenation axis should be the second argument passed to tf,concat. so basically you need to fix lines 86 and 95 by switching the arguments.
Hi, I switched the arguments in lines 86 and 95 Line 86: from: y_disc = tf.concat(0,[y, y 0]) to: y_disc = tf.concat([y, y 0], 0)
Line 95: from: z = tf.concat(1, [z_cat.sg_one_hot(depth=cat_dim), z_con, z_rand]) to: z = tf.concat([z_cat.sg_one_hot(depth=cat_dim), z_con, z_rand], 1)
and this following error occurs:
Traceback (most recent call last):
File "
File "C:\Program Files\Anaconda3\envs\tensorflow-gpu\lib\site-packages\spyder\utils\site\sitecustomize.py", line 710, in runfile execfile(filename, namespace)
File "C:\Program Files\Anaconda3\envs\tensorflow-gpu\lib\site-packages\spyder\utils\site\sitecustomize.py", line 101, in execfile exec(compile(f.read(), filename, 'exec'), namespace)
File "E:/ac-gan-master/train.py", line 103, in
File "E:/ac-gan-master/train.py", line 34, in generator .sg_dense(dim=1024, name='fc1')
File "C:\Program Files\Anaconda3\envs\tensorflow-gpu\lib\site-packages\sugartensor\sg_main.py", line 249, in wrapper mean, variance = tf.nn.moments(out, axes=range(len(out.get_shape()) - 1))
File "C:\Program Files\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\ops\nn_impl.py", line 638, in moments math_ops.reduce_mean(y, axes, keep_dims=True))
File "C:\Program Files\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\ops\math_ops.py", line 1355, in reduce_mean name=name)
File "C:\Program Files\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\ops\gen_math_ops.py", line 1290, in _mean keep_dims=keep_dims, name=name)
File "C:\Program Files\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 508, in apply_op (input_name, err))
ValueError: Tried to convert 'reduction_indices' to a tensor and failed. Error: Argument must be a dense tensor: range(0, 1) - got shape [1], but wanted [].
The complete fix to this problem is to switch the arguments on line 86 as mentioned above, and then replace line 95 with:
z = tf.concat(axis=1, values=[z_cat.sg_one_hot(depth=cat_dim), z_con, z_rand])
For some reason explicitly giving the arg names fixes it.
Hi, I met the same problem and solved it. The TensorFlow version mismatches SugarTensor here. You may try an earlier version of TensorFlow 1.7.
Also, you can modify the SugarTensor itself. Please go to sugartensor/sglogging.py,
line 170 and line 176. You can delete the underscore before _scaler_summary
and _histogram_summary
and reinstall it.
Thank for sharing this code, but when I trying to train this model with
python train.py
, the following error occurs:Traceback (most recent call last): File "train.py", line 86, in
y_disc = tf.concat(0, [y, y * 0])
File "/home/hao/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/array_ops.py", line 1062, in concat
).assert_is_compatible_with(tensor_shape.scalar())
File "/home/hao/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/tensor_shape.py", line 737, in assert_is_compatible_with
raise ValueError("Shapes %s and %s are incompatible" % (self, other))
ValueError: Shapes (2, 32) and () are incompatible