RuntimeError: shape '[300, 402, 64]' is invalid for input of size 51456
时间: 2023-09-24 15:14:10 浏览: 117
This error occurs when the size of the input tensor does not match the expected size. In this case, the expected size is [300, 402, 64], which means that the input should have 300 rows, 402 columns, and 64 channels. However, the actual size of the input tensor is 51456, which means that the input tensor does not have the correct shape.
To fix this error, you need to check the input tensor and make sure it has the correct shape. You can use the `shape` method to check the shape of the tensor. If the shape is incorrect, you can reshape the tensor using the `reshape` method.
For example, if you have a tensor with shape [51456], you can reshape it to [300, 402, 64] using the following code:
```
input_tensor = input_tensor.reshape((300, 402, 64))
```
Make sure to replace `input_tensor` with the actual name of your input tensor.
阅读全文