RuntimeError: shape [-1, 784] is invalid for input of size 131072
时间: 2023-09-29 20:04:28 浏览: 339
Python RuntimeError: thread.__init__() not called解决方法
5星 · 资源好评率100%
This error message indicates that the input tensor has a shape of [-1, 784], which means that the first dimension is unknown and the second dimension is 784. However, the size of the input tensor is 131,072, which is incompatible with the specified shape.
To fix this error, you should check the input data and make sure that it has the correct shape and size. It's possible that the input data has been incorrectly formatted or preprocessed, or that the model architecture is not compatible with the input data.
You can also try adjusting the shape of the input tensor to match the size of the input data. For example, you might need to reshape the input data to have a different number of dimensions or a different size for the first dimension. Alternatively, you might need to modify the model architecture to accept a different input shape.
Overall, the best approach to fixing this error will depend on the specific details of your model and input data.
阅读全文