InvalidArgumentError (see above for traceback): Assign requires shapes of both tensors to match. lhs shape= [100,10] rhs shape= [300,10]
[[Node: save/Assign_10 = Assign[T=DT_INT32, _class=["loc:@label"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/cpu:0"](label, save/RestoreV2_10)]]
[[Node: save/RestoreV2_8/_9 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/gpu:0", send_device="/job:localhost/replica:0/task:0/cpu:0", send_device_incarnation=1, tensor_name="edge_26_save/RestoreV2_8", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/gpu:0"]()]]
我使用批量大小训练数据是300,而我使用批量大小恢复和测试模型是100.我怎样才能解决这个问题。
答案 0 :(得分:0)
当您使用与您训练的CNN模型中定义的形状不同的形状提供张量时,通常会出现此错误。既然您说过首先训练然后恢复模型进行测试,请确保用于恢复模型的代码实例化您为训练定义的相同模型。