This PR adds a new CNN class in the src/cnn.py file to handle the MNIST dataset. The CNN class is designed to process 28x28 grayscale images and includes two convolutional layers, ReLU activations, max pooling, and two fully connected layers. Additionally, a train_cnn function is implemented to train the CNN using the provided DataLoader.
Summary of Changes
Created a new file src/cnn.py to contain the CNN class and training function.
Imported necessary PyTorch modules in src/cnn.py.
Defined a new class CNN in src/cnn.py that inherits from torch.nn.Module.
Implemented the __init__ method in CNN to define the layers of the CNN.
Implemented the forward method in CNN to perform the forward pass.
Defined a train_cnn function in src/cnn.py to train the CNN using the provided DataLoader.
Added docstrings and comments to the CNN class and train_cnn function.
Imported the CNN class and train_cnn function in src/main.py.
Created an instance of the CNN class in src/main.py.
Called the train_cnn function in src/main.py, passing the CNN instance, DataLoader, and number of epochs.
Please review and merge this PR to incorporate the new CNN class for handling the MNIST dataset.
Fixes #9.
🎉 Latest improvements to Sweep:
Sweep can now passively improve your repository! Check out Rules to learn more.
💡 To get Sweep to edit this pull request, you can:
Comment below, and Sweep can edit the entire PR
Comment on a file, Sweep will only modify the commented file
Edit the original issue to get Sweep to recreate the PR from scratch
Description
This PR adds a new CNN class in the
src/cnn.py
file to handle the MNIST dataset. The CNN class is designed to process 28x28 grayscale images and includes two convolutional layers, ReLU activations, max pooling, and two fully connected layers. Additionally, atrain_cnn
function is implemented to train the CNN using the provided DataLoader.Summary of Changes
src/cnn.py
to contain the CNN class and training function.src/cnn.py
.CNN
insrc/cnn.py
that inherits fromtorch.nn.Module
.__init__
method inCNN
to define the layers of the CNN.forward
method inCNN
to perform the forward pass.train_cnn
function insrc/cnn.py
to train the CNN using the provided DataLoader.CNN
class andtrain_cnn
function.CNN
class andtrain_cnn
function insrc/main.py
.CNN
class insrc/main.py
.train_cnn
function insrc/main.py
, passing the CNN instance, DataLoader, and number of epochs.Please review and merge this PR to incorporate the new CNN class for handling the MNIST dataset.
Fixes #9.
🎉 Latest improvements to Sweep:
💡 To get Sweep to edit this pull request, you can: