RuntimeError: stack expects each tensor to be equal size, but got [3, 100, 100] at entry 0 and [3, 432, 478] at entry 26
时间: 2024-02-10 07:56:03 浏览: 36
This error occurs when you try to stack tensors of different sizes along a certain dimension. In this case, the stack operation is expecting each tensor to have the same size along the specified dimension, but it is finding tensors with different sizes.
The error message indicates that there are two tensors being stacked, one with shape [3, 100, 100] and another with shape [3, 432, 478], and they are being stacked along the same dimension. Therefore, you need to resize or reshape the tensors to have the same size along that dimension before stacking them.
One solution could be to resize the tensor with shape [3, 100, 100] to [3, 432, 478] using an appropriate interpolation method, such as bilinear or nearest neighbor interpolation. Another solution could be to resize the tensor with shape [3, 432, 478] to [3, 100, 100] using the same interpolation method.
Alternatively, if you don't want to resize the tensors, you can stack them along a different dimension that has the same size for both tensors.
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)