alex-sage / logo-gen

Accompanying code for the paper "Logo Synthesis and Manipulation with Clustered Generative Adversarial Networks"
MIT License
86 stars 25 forks source link

Run inception_score.py and got an ValueError problem #2

Closed kawsor closed 5 years ago

kawsor commented 5 years ago

Traceback (most recent call last): File "/anaconda2/envs/untitled/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1626, in _create_c_op c_op = c_api.TF_FinishOperation(op_desc) tensorflow.python.framework.errors_impl.InvalidArgumentError: Shape must be rank 2 but is rank 1 for 'MatMul' (op: 'MatMul') with input shapes: [2048], [2048,1008].

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/kawsorandy/TensorFlow/WGAN/tflib/inception_score.py", line 96, in _init_inception() File "/Users/kawsorandy/TensorFlow/WGAN/tflib/inception_score.py", line 92, in _init_inception logits = tf.matmul(tf.squeeze(pool3), w) File "/anaconda2/envs/untitled/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 2053, in matmul a, b, transpose_a=transpose_a, transpose_b=transpose_b, name=name) File "/anaconda2/envs/untitled/lib/python3.6/site-packages/tensorflow/python/ops/gen_math_ops.py", line 4560, in mat_mul name=name) File "/anaconda2/envs/untitled/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "/anaconda2/envs/untitled/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 488, in new_func return func(*args, **kwargs) File "/anaconda2/envs/untitled/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3272, in create_op op_def=op_def) File "/anaconda2/envs/untitled/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1790, in init control_input_ops) File "/anaconda2/envs/untitled/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1629, in _create_c_op raise ValueError(str(e)) ValueError: Shape must be rank 2 but is rank 1 for 'MatMul' (op: 'MatMul') with input shapes: [2048], [2048,1008].

Process finished with exit code 1

alex-sage commented 5 years ago

For future reference: This happens if you try to run the network with a wrong TF version. Try tensorflow 1.3.0 which it has been tested for.

kdy1 commented 4 years ago

@alex-sage I hit this error with tensorflow 1.3.0 (cpu) I could not install tensorflow-gpu==1.3.0 because old cuda library file does not exist.

>>> tf.__version__
'1.3.0'

Changing to

        logits = tf.matmul(tf.squeeze(pool3, [1, 2]), w)

fixes the issue