carpedm20 / DCGAN-tensorflow

A tensorflow implementation of "Deep Convolutional Generative Adversarial Networks"
http://carpedm20.github.io/faces/
MIT License
7.15k stars 2.63k forks source link

failed to visualize #62

Closed Engineering-Course closed 7 years ago

Engineering-Course commented 7 years ago

When I set FLAGS.visualize to True, it occurs an error as follows. How can I fix it please?

Traceback (most recent call last): File "main.py", line 60, in tf.app.run() File "/home/clay/anaconda2/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 43, in run sys.exit(main(sys.argv[:1] + flags_passthrough)) File "main.py", line 57, in main visualize(sess, dcgan, FLAGS, OPTION) File "/home/clay/code/DCGAN-tensorflow/utils.py", line 171, in visualize samples = sess.run(dcgan.sampler, feed_dict={dcgan.z: z_sample}) File "/home/clay/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 766, in run run_metadata_ptr) File "/home/clay/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 964, in _run feed_dict_string, options, run_metadata) File "/home/clay/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1014, in _do_run target_list, options, run_metadata) File "/home/clay/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1034, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.InvalidArgumentError: You must feed a value for placeholder tensor 'y' with dtype float and shape [64,10] [[Node: y = Placeholder[dtype=DT_FLOAT, shape=[64,10], _device="/job:localhost/replica:0/task:0/gpu:0"]()]] [[Node: Sigmoid_2/_75 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/cpu:0", send_device="/job:localhost/replica:0/task:0/gpu:0", send_device_incarnation=1, tensor_name="edge_228_Sigmoid_2", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"]()]]

Caused by op u'y', defined at: File "main.py", line 60, in tf.app.run() File "/home/clay/anaconda2/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 43, in run sys.exit(main(sys.argv[:1] + flags_passthrough)) File "main.py", line 38, in main dataset_name=FLAGS.dataset, is_crop=FLAGS.is_crop, checkpoint_dir=FLAGS.checkpoint_dir, sample_dir=FLAGS.sample_dir) File "/home/clay/code/DCGAN-tensorflow/model.py", line 67, in init self.build_model() File "/home/clay/code/DCGAN-tensorflow/model.py", line 71, in build_model self.y= tf.placeholder(tf.float32, [self.batch_size, self.y_dim], name='y') File "/home/clay/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/array_ops.py", line 1633, in placeholder name=name) File "/home/clay/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/gen_array_ops.py", line 2043, in _placeholder name=name) File "/home/clay/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 763, in apply_op op_def=op_def) File "/home/clay/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2371, in create_op original_op=self._default_original_op, op_def=op_def) File "/home/clay/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1258, in init self._traceback = _extract_stack()

InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor 'y' with dtype float and shape [64,10] [[Node: y = Placeholder[dtype=DT_FLOAT, shape=[64,10], _device="/job:localhost/replica:0/task:0/gpu:0"]()]] [[Node: Sigmoid_2/_75 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/cpu:0", send_device="/job:localhost/replica:0/task:0/gpu:0", send_device_incarnation=1, tensor_name="edge_228_Sigmoid_2", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"]()]]

carpedm20 commented 7 years ago

I add a codes for visualize mnist. Please pull the code and try again.