Open main menu

CDOT Wiki β

Changes

DPS921/PyTorch: Convolutional Neural Networks

181 bytes added, 12:44, 29 November 2020
Implementation of Neural Network
''' 1. Import the required modules to implement and download the datasets required to train the neural network.
import torch
from torchvision import transforms, datasets
 ''' 2. Download the needed datasets from the MNIST APIdatabase, partition them to feasible databatch sizes.
train = datasets.MNIST('', train = True, 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)
 
 
''' 3. Import the necessary modules to define the structure of our neural network
 
import torch.nn as nn
import torch.nn.functional as F
== Getting Started With Jupyter lab ==