def test_match_accuracy(network, loader, device) -> float:
    """
    Test the match accuracy of a network on a dataset.

    :param network: network to test
    :param loader: loader to test
    :param device: device to use
    :return: result accuracy
    """
    network.eval()
    network.classify = False

    accuracy = 0

    for _, (inputs, labels) in enumerate(loader):
        inputs = inputs.to(device)

        outputs = network(inputs)

        for i in range(0, len(inputs), 3):
            triplet = outputs[i : i + 3]
            distance = [
                (triplet[0] - triplet[1]).norm().item(),
                (triplet[0] - triplet[2]).norm().item(),
            ]
            if distance[0] < distance[1]:
                accuracy += 1

    accuracy /= len(loader.dataset)
    return accuracy