For epoch in range(Epochs):
for data in trainloader:
image, label= data
o_image = train_model(image)
loss = criterion(o_image, image)
loss.backward()
optimizer.step()
optimizer.zero_grad()
pred = torch.argmax(o_image, 1)
accuracy_score = accuracy_score(label, pred)
print(‘Epoch:{}, Loss:{:.4f}’.format(epoch+1, float(loss)), accuracy_score)