update accuracy function
This commit is contained in:
@ -115,8 +115,8 @@ for epoch in range(EPOCH):
|
||||
|
||||
if step % 50 == 0:
|
||||
test_output, last_layer = cnn(test_x)
|
||||
pred_y = torch.max(test_output, 1)[1].data.squeeze()
|
||||
accuracy = float(sum(pred_y == test_y)) / float(test_y.size(0))
|
||||
pred_y = torch.max(test_output, 1)[1].data.squeeze().numpy()
|
||||
accuracy = float((pred_y == test_y.data.numpy()).astype(int).sum()) / float(test_y.size(0))
|
||||
print('Epoch: ', epoch, '| train loss: %.4f' % loss.data.numpy(), '| test accuracy: %.2f' % accuracy)
|
||||
if HAS_SK:
|
||||
# Visualization of trained flatten layer (T-SNE)
|
||||
|
||||
Reference in New Issue
Block a user