成功解决ValueError: Cannot feed value of shape (1, 10, 4) for Tensor Placeholder:0 , which has shape

简介: 成功解决ValueError: Cannot feed value of shape (1, 10, 4) for Tensor Placeholder:0 , which has shape


目录

解决问题

解决思路

解决方法


 

 

 

解决问题

ValueError: Cannot feed value of shape (1, 10, 4) for Tensor 'Placeholder:0', which has shape '(?, 15, 4)'

 

 

 

解决思路

值错误:无法为张量'Pl提供形状(1、10、4)的值Placeholder:0',此时形状为'(?,15,4)'

 

 

解决方法

两个Tensor的维度不一致导致,所以要保持输出数据的维度一致,博主通过调整维度,最后将通过匹配解决了这个问题。大家可以尝试输出shape,要保持一致即可!

如网友遇到问题 不解,可留言与博主共同探讨!


相关文章
|
存储 PyTorch 算法框架/工具
Tensor to img && imge to tensor (pytorch的tensor转换)
Tensor to img && imge to tensor (pytorch的tensor转换)
|
PyTorch 算法框架/工具 异构计算
Pytorch出现RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor)
这个问题的主要原因是输入的数据类型与网络参数的类型不符。
200 0
[AssertionError: nput tensor input format are different]
分析到这儿就明白了。input tensor虽然格式也是CHW, 但它还有一个batch维度,所以报错。
126 0
|
存储 测试技术
测试模型时,为什么要with torch.no_grad(),为什么要model.eval(),如何使用with torch.no_grad(),model.eval(),同时使用还是只用其中之一
在测试模型时,我们通常使用with torch.no_grad()和model.eval()这两个方法来确保模型在评估过程中的正确性和效率。
620 0
怎么将[tensor([[ 1, 2]]), tensor([[5, 6]]), tensor([[9, 10]])] 合并成 tensor([[1,2],[3,4],[5,6]])
可以先使用 torch.cat() 函数将列表中的张量在第0维(行)上进行拼接,然后再使用 .view() 函数将形状调整为需要的形状。
130 0
torch中如何将tensor([[1, 2, 3]]) 和 tensor([4]) 合并成 tensor([[1,2,3,4]])
可以使用 torch.cat() 方法将两个张量沿着指定的维度进行拼接
388 0
|
PyTorch 算法框架/工具
pytorch报错 RuntimeError: The size of tensor a (25) must match the size of tensor b (50) at non-singleton dimension 1 怎么解决?
这个错误提示表明,在进行某个操作时,张量a和b在第1个非单例维(即除了1以外的维度)上的大小不一致。例如,如果a是一个形状为(5, 5)的张量,而b是一个形状为(5, 10)的张量,则在第二个维度上的大小不匹配。
3132 0
|
机器学习/深度学习 算法框架/工具
【问题记录与解决】KeyError: ‘acc‘ plt.plot(N[150:], H.history[“acc“][150:], label=“train_acc“) # KeyError: ‘
【问题记录与解决】KeyError: ‘acc‘ plt.plot(N[150:], H.history[“acc“][150:], label=“train_acc“) # KeyError: ‘
【问题记录与解决】KeyError: ‘acc‘ plt.plot(N[150:], H.history[“acc“][150:], label=“train_acc“) # KeyError: ‘
解决AssertionError: size of input tensor and input format are different.tensor shape: (3, 138input_for
解决AssertionError: size of input tensor and input format are different.tensor shape: (3, 138input_for
312 0
成功解决ValueError: Cannot feed value of shape (1, 10, 4) for Tensor Placeholder:0 , which has shape
成功解决ValueError: Cannot feed value of shape (1, 10, 4) for Tensor Placeholder:0 , which has shape
http://www.vxiaotou.com