neural_network #4
@ -30,7 +30,6 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
for epoch in range(n_iter):
|
for epoch in range(n_iter):
|
||||||
for image, label in zip(train_images, train_labels):
|
for image, label in zip(train_images, train_labels):
|
||||||
print(image.shape)
|
|
||||||
optimizer.zero_grad()
|
optimizer.zero_grad()
|
||||||
|
|
||||||
output = model(image)
|
output = model(image)
|
||||||
@ -44,7 +43,7 @@ if __name__ == '__main__':
|
|||||||
train(model, 100)
|
train(model, 100)
|
||||||
|
|
||||||
# def accuracy(expected, predicted):
|
# def accuracy(expected, predicted):
|
||||||
# return len([1 for e, p in zip(expected, predicted) if e == p]) / len(expected)
|
# return len([_ for e, p in zip(expected, predicted) if e == p]) / len(expected)
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# predicted = [model(image).argmax() for image in train_images]
|
# predicted = [model(image).argmax() for image in train_images]
|
||||||
|
Loading…
Reference in New Issue
Block a user