import torch
print(torch.__version__)
1.12.1
PyTorch is an open-source machine learning library for Python, based on the Torch library, used for applications such as deep learning and GPU based acceleration. It is primarily developed by Facebook’s artificial intelligence research group. PyTorch provides a high-level interface for working with large-scale machine learning models. It allows developers to define and train neural networks in a fast, flexible, and dynamic way.
Some key features of PyTorch include:
Overall, PyTorch is a powerful and flexible tool for working with large-scale machine learning models and is widely used in research and industry.
Since Pytorch is under active development and the new version keeps getting released. You want to visit this website for the latest Pytorch installation instruction.
The above interface is what you will typically see on the installation page, based on your OS and other selection, it will produce a command you can run on your command line interface and install Pytorch. I recommend installing through conda as it will take care of the dependencies automatically.
Let’s run the import command and see if we have Pytorch setup correctly.
import torch
print(torch.__version__)
1.12.1
It is recommended to use a machine with a GPU when working with PyTorch because it is typically used for GPU-accelerated computations. If you are running PyTorch on a machine with a GPU and want to verify that it has access to the GPU, you can run the following command-
torch.cuda.is_available()
True
If PyTorch is installed on a machine with a GPU, the above command will return True
otherwise it will return False
.