I want to check torch version in my device using Jupyter Notebook.
I’m used this
JavaScript
x
3
1
import torch
2
print(torch.__version__)
3
but it didn’t work and Jupyter notebook raised an error as below
JavaScript
1
7
1
AttributeError Traceback (most recent call last)
2
<ipython-input-8-beb55f24d5ec> in <module>
3
1 import torch
4
----> 2 print(torch.__version__)
5
6
AttributeError: module 'torch' has no attribute '__version__'
7
Is there any command to check torch version using Jupyter notebook?
Advertisement
Answer
I have tried to install new Pytorch version. But, it didn’t work and then I deleted the Pytorch files manually suggested on my command line. Finally, I installed new Pytorch version using conda install pytorch torchvision torchaudio cudatoolkit=11.0 -c pytorch
and everything works fine.
This code works well after that.
JavaScript
1
3
1
import torch
2
print(torch.__version__)
3