Skip to content

Instantly share code, notes, and snippets.

@agastidukare
Created April 1, 2020 02:37
Show Gist options
  • Save agastidukare/b42f80245192e8e98a08a69781c7543c to your computer and use it in GitHub Desktop.
Save agastidukare/b42f80245192e8e98a08a69781c7543c to your computer and use it in GitHub Desktop.
# This function calculates, loss, predictions and gradients
def covnet(t,params):
test_acc,target_class, predicted_class = accuracy(params, shape_as_image(test_images, test_labels))
test_loss = loss(params, shape_as_image(test_images, test_labels),test=t)
grads = grad(lo)(shape_as_image(test_images, test_labels),params)
if(t==1):
print('Test set loss, accuracy (%): ({:.2f}, {:.2f})'.format(test_loss, 100 * test_acc))
print('predicted_class,target_class', predicted_class,target_class)
return grads, test_acc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment