Home > other >  InvalidArgumentError (see above for traceback) : Incompatible shapes: [6, 7] vs.
InvalidArgumentError (see above for traceback) : Incompatible shapes: [6, 7] vs.

Time:09-26

Under Caused by op 'model/mean_squared_error/SquaredDifference', defined at:
The File "code2seq_lkf. Py, line 40, in & lt; module>
Model. The train ()
The File "/MNT/lkf_u code2seq/model_lkf py", line 89, "train" in
Self. Build_training_graph (self) queue_thread) get_output (), and rewards)
The File "/MNT/lkf_u code2seq/model_lkf py", line 538, in build_training_graph
Critic_loss=tf. Losses. Mean_squared_error (labels=rewards, predictions=critic_outputs, weights=critic_weights) # shape is not the same as the label, is a scalar
The File "/home/LKF/lkf_u/anaconda3/envs/tf1.12/lib/python3.6/site - packages/tensorflow/python/ops/losses/losses_impl py", line 671, in mean_squared_error
Losses=math_ops. Squared_difference (predictions, labels)
The File "/home/LKF/lkf_u/anaconda3/envs/tf1.12/lib/python3.6/site - packages/tensorflow/python/ops/gen_math_ops. Py", line 8258, in squared_difference
"SquaredDifference", x=x, y=y, name=name)
The File "/home/LKF/lkf_u/anaconda3/envs/tf1.12/lib/python3.6/site - packages/tensorflow/python/framework/op_def_library. Py", line 787, in _apply_op_helper
Op_def=op_def)
The File "/home/LKF/lkf_u/anaconda3/envs/tf1.12/lib/python3.6/site - packages/tensorflow/python/util/deprecation. Py", line 488, in new_func
Return func (* args, * * kwargs)
The File "/home/LKF/lkf_u/anaconda3/envs/tf1.12/lib/python3.6/site - packages/tensorflow/python/framework/ops. Py", line 3274, in create_op
Op_def=op_def)
The File "/home/LKF/lkf_u/anaconda3/envs/tf1.12/lib/python3.6/site - packages/tensorflow/python/framework/ops. Py", line 1770, in __init__
Self. _traceback=tf_stack. Extract_stack ()

InvalidArgumentError (see above for traceback) : Incompatible shapes: [6, 7] vs. (256, 7)
[[node model/mean_squared_error SquaredDifference (defined at/MNT/lkf_u code2seq/model_lkf. Py: 538)=SquaredDifference [T=DT_FLOAT, _device="/task/job: localhost/up: 0:0/device: the GPU: 0"] (model/advertisement, model/transpose)]]
[[{{node model/mean_squared_error/num_present/broadcast_weights assert_broadcastable/AssertGuard/Assert/Switch_1/_527}}=_Recv [client_terminated=false, recv_device="/task/job: localhost/up: 0:0/device: CPU: 0", send_device="/task/job: localhost/up: 0:0/device: the GPU: 0", send_device_incarnation=1, tensor_name="edge_2333_... t/Switch_1 tensor_type=DT_INT32, _device="/task/job: localhost/up: 0:0/device: CPU: 0 "] ()]]

. I use the tf placeholder, does not specify the size of the batch_size, but I looked at the data before the feed in shape, just like the batch_size size, the result appears this wrong, I'm in the go in for it is the only operation of tf, transpose, what reason be excuse me

CodePudding user response:

Check the matrix dimensions, model a print shape each step of the way
  • Related