InvalidArgumentError: Input to reshape is a tensor with 3200 values, but the requested shape requires a multiple of 49
VAEのもとのソースをgoogle colabで実行したら、以下のようなエラーがでた。
for i in range(30000): batch = [np.reshape(b, [28, 28]) for b in mnist.train.next_batch(batch_size=batch_size)[0]] sess.run(optimizer, feed_dict = {X_in: batch, Y: batch, keep_prob: 0.8}) if not i % 200: ls, d, i_ls, d_ls, mu, sigm = sess.run([loss, dec, img_loss, latent_loss, mn, sd], feed_dict = {X_in: batch, Y: batch, keep_prob: 1.0}) plt.imshow(np.reshape(batch[0], [28, 28]), cmap='gray') plt.show() plt.imshow(d[0], cmap='gray') plt.show() print(i, ls, np.mean(i_ls), np.mean(d_ls))
--------------------------------------------------------------------------- InvalidArgumentError Traceback (most recent call last) /usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py in _do_call(self, fn, *args) 1291 try: -> 1292 return fn(*args) 1293 except errors.OpError as e: /usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py in _run_fn(feed_dict, fetch_list, target_list, options, run_metadata) 1276 return self._call_tf_sessionrun( -> 1277 options, feed_dict, fetch_list, target_list, run_metadata) 1278 /usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py in _call_tf_sessionrun(self, options, feed_dict, fetch_list, target_list, run_metadata) 1366 self._session, options, feed_dict, fetch_list, target_list, -> 1367 run_metadata) 1368 InvalidArgumentError: Input to reshape is a tensor with 3200 values, but the requested shape requires a multiple of 49 [[{{node decoder/Reshape}} = Reshape[T=DT_FLOAT, Tshape=DT_INT32, _device="/job:localhost/replica:0/task:0/device:GPU:0"](decoder/dense_1/Maximum, decoder/Reshape/shape)]]
import tensorflow; print(tensorflow.__version__)
1.11.0