Changes

Jump to: navigation, search

DPS921/PyTorch: Convolutional Neural Networks

486 bytes added, 12:38, 29 November 2020
Implementation of Neural Network
== Implementation of Neural Network ==
''' In order to implement a Convolutional Neural Network in python, there are several key steps we need to follow:
== ''' In order to implement a Convolutional Neural Network in python, there are several key steps we need to follow: ==  ''' 1. Import the required modules to implement and train the neural network.
import torch
import torchvision
from torchvision import transforms, datasets
 
''' 2. Download the needed datasets from the MNIST API, partition them to feasible data
 
train = datasets.MNIST('', train = True, download = True, transform=transforms.Compose([transforms.ToTensor()]))
test = datasets.MNIST('', train = False, download = True, transform=transforms.Compose([transforms.ToTensor()]))
 
trainset = torch.utils.data.DataLoader(train, batch_size = 10, shuffle = True)
testset = torch.utils.data.DataLoader(test, batch_size = 10, shuffle = False)
== Getting Started With Jupyter lab ==

Navigation menu