def test_v1_5_metric_accuracy():
    accuracy.warned = False
    with pytest.deprecated_call(match='It will be removed in v1.5.0'):
        assert accuracy(preds=torch.tensor([0, 1]), target=torch.tensor([0, 1])) == torch.tensor(1.)

    Accuracy.__init__.warned = False
    with pytest.deprecated_call(match='It will be removed in v1.5.0'):
        Accuracy()
예제 #2
0
def test_v1_5_metric_accuracy():
    accuracy._warned = False

    preds = torch.tensor([0, 0, 1, 0, 1])
    target = torch.tensor([0, 0, 1, 1, 1])
    with pytest.deprecated_call(match="It will be removed in v1.5.0"):
        assert accuracy(preds, target) == torch.tensor(0.8)

    Accuracy.__init__._warned = False
    with pytest.deprecated_call(match="It will be removed in v1.5.0"):
        Accuracy()