def test(model, loss_function, torch_ref, data, labels, device):
    """ A generic testing function without batching.
    
     Arguments:
        model (object): Remote or local model.
        torch_ref (object): Remote or local torch reference.
        loss_function (object): Remote or local loss function.
        data (torch.Tensor): A Tensor or TensorPointer conatining the test data.
        labels (torch.Tensor): A Tensor or TensorPointer containing the test labels.
        device (torch.device): The device to train on.
    """
    model.eval()
    
    data = data.to(device)
    labels = labels.to(device)
    length = len(data)
    
    with torch_ref.no_grad():
        output = model(data)
        test_loss = loss_function(output, labels)
        prediction = output.argmax(dim=1)
        total = prediction.eq(labels).sum().item()
        
    acc_ptr = total / length
    if model.is_local:
        acc = acc_ptr
        loss = test_loss.item()
    else:
        acc = acc_ptr.get(reason="To evaluate training progress", request_block=True, timeout_secs=5)
        loss = test_loss.item().get(reason="To evaluate training progress", request_block=True, timeout_secs=5)

    return acc, loss