示例#1
0
    def test_value_range_loss_zero(self):
        torch.manual_seed(0)
        input = torch.rand(1, 3, 128, 128)

        actual = F.value_range_loss(input)
        desired = 0.0
        self.assertFloatAlmostEqual(actual, desired)
示例#2
0
def test_value_range_loss_zero():
    torch.manual_seed(0)
    input = torch.rand(1, 3, 128, 128)

    actual = F.value_range_loss(input)
    desired = 0.0
    assert desired == ptu.approx(actual)
示例#3
0
def test_ValueRangeOperator_call():
    torch.manual_seed(0)
    image = torch.randn(1, 3, 128, 128)

    op = ops.ValueRangeOperator()

    actual = op(image)
    desired = F.value_range_loss(image)
    ptu.assert_allclose(actual, desired)
示例#4
0
    def test_ValueRangeOperator_call(self):
        torch.manual_seed(0)
        image = torch.randn(1, 3, 128, 128)

        op = ops.ValueRangeOperator()

        actual = op(image)
        desired = F.value_range_loss(image)
        self.assertTensorAlmostEqual(actual, desired)