Skip to content
Advertisement

How to know torch version that installed locally in your device

I want to check torch version in my device using Jupyter Notebook.

I’m used this

import torch
print(torch.__version__)

but it didn’t work and Jupyter notebook raised an error as below

AttributeError                            Traceback (most recent call last)
<ipython-input-8-beb55f24d5ec> in <module>
      1 import torch
----> 2 print(torch.__version__)

AttributeError: module 'torch' has no attribute '__version__'

Is there any command to check torch version using Jupyter notebook?

Advertisement

Answer

enter image description here

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.

import torch
print(torch.__version__)
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement