pip3 install pytorch code example
Example 1: get pytorch version
import torch
print(torch.__version__)
Example 2: torch conda
conda install pytorch torchvision cudatoolkit=10.2 -c pytorch
Example 3: python3 pip install
[server]$ python3 -m pip install
Example 4: mac install pytorch 3.6
conda install pytorch torchvision -c pytorch
Example 5: torch import
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader
from torchvision import datasets, transforms, models
from torchvision.utils import make_grid
import numpy as np
import pandas as pd
from sklearn.metrics import confusion_matrix
import matplotlib.pyplot as plt
%matplotlib inline
transform = transforms.ToTensor()
train_data = datasets.FashionMNIST(root='../Data', train=True, download=True, transform=transform)
test_data = datasets.FashionMNIST(root='../Data', train=False, download=True, transform=transform)