9951 explained code solutions for 126 technologies


python-pytorchHow do I show the version of PyTorch I am using?


  1. To show the version of PyTorch you are using, you can use the torch.__version__ attribute.
import torch
print(torch.__version__)

Output example

1.3.1

  1. The torch.__version__ attribute is a string that contains the version of PyTorch you are using.

  2. You can also access the version of PyTorch you are using from the command line using the pip command.

pip show torch

Output example

Name: torch
Version: 1.3.1
Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration
Home-page: https://pytorch.org/
Author: PyTorch Team
Author-email: [email protected]
License: BSD
Location: /usr/local/lib/python3.6/dist-packages
Requires: future, numpy, torchvision
Required-by:
  1. To check if you have the newest version of PyTorch, you can run the pip install --upgrade torch command.

  2. This will upgrade the version of PyTorch to the newest version available.

  3. You can also use the pytorch.org website to check the version of PyTorch you are using.

  4. On the website, you can click on the "Download" button and select the version of PyTorch you are using.

Helpful links

Edit this code on GitHub