import torch


def eval_minibatch(network, examples, labels):
	""" Evaluates the top1 accuracy of the provided minibatch
	ARGS:
		network: ReLUNet instance - network we evaluate 
		examples: tensor - images to input into the network 
		labels : LongTensor - correct labels of the images
	RETURNS:
		{num_correct: # of correct images
		 percentage_correct: percentage of correct images (float in [0, 1])}
	"""
	computed_labels = torch.max(network(examples), 1)[1]
	num_correct = (computed_labels == labels).sum().item()
	return {'num_correct': num_correct,
			'total': len(labels),
	  	    'percentage_correct': float(num_correct) / float(len(labels))}