Input(X) and Input(Label) shall have the same shape,cross_entropy2 error
Created by: JimReacher
def infer(image_path): tensor_img = read_image(image_path) label = exe.run(inference_program, feed={feed_target_names[0]: tensor_img}, fetch_list=fetch_targets) return np.argmax(label) 训练完模型出现以下错误,请问是怎么回事?
Error Message Summary:
Error: ShapeError: Input(X) and Input(Label) shall have the same shape except the last dimension. But received: the shape of Input(X) is [1, 40],the shape of Input(Label) is [0]. [Hint: Expected framework::slice_ddim(x_dims, 0, rank - 1) == framework::slice_ddim(label_dims, 0, rank - 1), but received framework::slice_ddim(x_dims, 0, rank - 1):1 != framework::slice_ddim(label_dims, 0, rank - 1):0.] at (/paddle/paddle/fluid/operators/cross_entropy_op.cc:51) [operator < cross_entropy2 > error]