Pytorch Introduction

Posted on Wed 26 October 2022 in Introduction

Pytorch is python bindings for the Torch library from Lua, which is a machine learning framework based on using GPUs as the compute platform.

Install

python -m pip install --upgrade pip
python -m pip install pytorch

Check if GPU is being used

import torch
torch.cuda.is_available()
torch.cuda.device_count()
torch.cuda.current_device()
torch.cuda.device(0)
torch.cuda.get_device_name(0)

This should show something like 'GeForce GTX 940M', or whatever your GPU name is.