84
edits
Changes
→Implementation of a Neural Network
import torch.optim as optim
optimizer = optim.Adam(net.parameters(), lr=0.001)
EPOCHS = 3
print("Accuracy: ", round(correct/total, 3))
''' 7. View the data at index of 0 in the training data set as 28 x 28 Image, Making sure to import 'matplotlib'.
import matplotlib.pyplot as plt
plt.imshow(X[0].view(28,28))
plt.show()
''' 8. Test the trained neural network to check whether the digit value shown in the image is in fact the number
the neural network determined it to be.
print(torch.argmax(net(X[0].view(-1, 784))[0]))
== Getting Started With Jupyter ==