错误信息:
Traceback (most recent call last):
File "spritegen.py", line 71, in <module>
tf.app.run()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 44, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "spritegen.py", line 51, in main
cp_directory=FLAGS.checkpoint_dir)
File "/home/lewis/Documents/Sprite Generator/Sprite-Generator/dcgan.py", line 99, in __init__
self.build()
File "/home/lewis/Documents/Sprite Generator/Sprite-Generator/dcgan.py", line 113, in build
self.G = self.generator(self.z)
File "/home/lewis/Documents/Sprite Generator/Sprite-Generator/dcgan.py", line 281, in generator
self.h0 = tf.reshape(self.z,[-1, sample_H16, sample_W16, self.gen_dimension * 8])
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 2630, in reshape
name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 585, in apply_op
param_name=input_name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 61, in _SatisfiesTypeConstraint
", ".join(dtypes.as_dtype(x).name for x in allowed_list)))
TypeError: Value passed to parameter 'shape' has DataType float32 not in list of allowed values: int32, int64
这个类型的错误信息需要将参数类型进行转换,要注意的是,修改具体调用了包含那个参数的函数就可以了。
我的错误信息返回了很多,修改时需要改的地方为:
self.h0 = tf.reshape(self.z,[-1, sample_H16, sample_W16, self.gen_dimension * 8])
将其中的参数进行类型转换,改为:
self.h0 = tf.reshape(self.z,[-1, sample_H16, sample_W16, int(self.gen_dimension * 8)])
以上。