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, PyTorch, and YOLOv5 to build an object detection model?
- How can I use Python and PyTorch to parse XML files?
- How can I use Python and PyTorch together with Xorg?
- How can I use PyTorch with Python 3.11?
- How can I use PyTorch with Python 3.10?
- How do I install PyTorch on Ubuntu using Python?
- How do I use Pytorch with Python 3.11 on Windows?
- How can I use Python and PyTorch to create an XOR gate?
- How can I use Python PyTorch with CUDA?
See more codes...