Using Pytorch GPU with Numpy and Sklearn


I have been using PyTorch for a while but since I switched over to the GPU I have realised that I made quite a few assumptions and would therefore like clarity:

  • Since Numpy is not designed for GPU, should one always aim to use an alternate like Cupy? The tutorials state that numpy can be used to process the data and then convert to tensor, does this mean that only AFTER the data has been sent to the GPU, numpy should not be used?

  • Similarly, since SKLearn is not for GPU, should one always look for Pytorch implementations for the standard stuff like classification report, confusion matrix, gridsearchcv… (I have been getting TypeError: Implicit conversion to a NumPy array is not allowed)

Thanks for your help.

Most linear algebra from numpy should be include with PyTorch already, but if you’re looking for a GPU supported version of sklearn, try skorch! GitHub - skorch-dev/skorch: A scikit-learn compatible neural network library that wraps PyTorch</t