Sure.
def test(model, testloader):
    model.eval()
    correct, total = 0, 0
    with torch.no_grad():
        for idx, (data, labels) in enumerate(testloader):
                data, labels = data.cuda(), labels.cuda()
                outputs = model(data)
                _, predicted = torch.max(outputs.data, 1)
                total += labels.size(0)
                correct += (predicted == labels).sum().float().item()

    acc = correct * 100. / total
    err = 100. - acc
    return acc, err