python-pytorchHow do I show the version of PyTorch I am using?
- 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
-
The
torch.__version__
attribute is a string that contains the version of PyTorch you are using. -
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:
-
To check if you have the newest version of PyTorch, you can run the
pip install --upgrade torch
command. -
This will upgrade the version of PyTorch to the newest version available.
-
You can also use the
pytorch.org
website to check the version of PyTorch you are using. -
On the website, you can click on the "Download" button and select the version of PyTorch you are using.
Helpful links
More of Python Pytorch
- How can I use Yolov5 with PyTorch?
- How can I use Python and PyTorch to parse XML files?
- How do I install PyTorch on a Windows computer?
- What is the most compatible version of Python to use with PyTorch?
- How do I use Pytorch with Python 3.11 on Windows?
- How can I use Python PyTorch with CUDA?
- How can I compare Python PyTorch and Torch for software development?
- What is the best version of Python to use with PyTorch?
- How do I install a Python PyTorch .whl file?
- How can I use Python and PyTorch to create a U-Net architecture?
See more codes...