This error occurs because the size of the tensor 'param.data' is different from the size of the tensor 'selected_particles[i].position' at a non-singleton dimension.

In other words, the two tensors have different shapes and cannot be copied into each other.

To resolve this error, you need to make sure that the size of the 'param.data' tensor matches the size of the 'selected_particles[i].position' tensor at the dimension where the sizes differ.

You can do this by either resizing the 'param.data' tensor or the 'selected_particles[i].position' tensor to match each other's shape.

Alternatively, you can modify your code to ensure that the tensors being copied into each other have the same shape.

Python RuntimeError: Tensor Size Mismatch in PyTorch

原文地址: https://www.cveoy.top/t/topic/nFNl 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录