feat: Default device is set to model device - #117
Conversation
Avoids specifying device since the input tensor needs to be on the same on as the model. This is useful in multi-GPUs environment or to freely use the function on CPU
|
The current implementation in Current implementation assumes CUDA by default - which is not my case (for example) using This PR is very flexible adapting the So totally 👍 for me! |
|
I'd like to add my one cent to the discussion. but it created a very similar problem to the one @frgfm had ("Input type (torch.FloatTensor) and weight type (torch.DoubleTensor) should be the same"). So here is another fix to the problem: So instead of initializing torch.FloatTensor as a default one, create a tensor and check its type on the device. That will prevent the problem from happening. |
|
Thanks for the suggestion! I had that in mind too, for personal use, I made a whole new python package, which I maintain very actively (and added a few other features, including experimental receptive field computation). Here it is: https://github.com/frgfm/torch-scan Feel free to drop suggestions or issues, hope that helps! |
Avoids specifying device since the input tensor needs to be on the same on as the model. This is useful in multi-GPUs environment or to freely use the function on CPU.
Previously
would fairly yield
The device is now dynamically set to the model device.
Any feedback is welcome, cheers!