convolutional neural networks listing - importing the required packages #pytorch utility imports import torch from torch utils data import dataloadertensordataset #neural net imports import torch nn as nntorch nn functional as ftorch optim as optim from torch autograd import variable #import external libraries import pandas as pd,numpy as np,matplotlib pyplot as pltos from sklearn model_selection import train_test_split from sklearn metrics import confusion_matrixaccuracy_score %matplotlib inline #set device to gpu or cpu based on availability if torch cuda is_available()device torch device('cuda'elsedevice torch device('cpu'we will now load the dataset using pandas (similar to and separate the label and pixel values note that most image datasets are stored in simple image formats jpeg or pngin simple folder structure that is suitable for pytorch for the simplicity of this examplehoweverwe use dataset wherein pixel values are stored as cross-sectional data in csv file we will then split the dataset into training and testand plot few samples in the next examplewe will use dataset that would be stored in the traditional folder structure in this examplewe will use tensordataseta wrapper provided by pytorch to combine labels and tensors into unified dataset listing - demonstrates loading the dataset into memory