swin_transformer_v2.py RuntimeError Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking argument for argument max in method wrapper_CUDA_clamp_Tensor)

Author: woongjoonchoiCreated Jan 20, 2025Updated Jan 20, 2025

when train with swin-transformer-v2 , RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking argument for argument max in method wrapper_CUDA_clamp_Tensor) happend.

Here is Pull Request Link that fix RuntimeError.

https://github.com/microsoft/Swin-Transformer/pull/376

Source: microsoft/Swin-Transformer