示例#1
0
def test_validate_abstract_2():
    bad_array = AbstractArray(to_abstract_test(f64), {
        SHAPE: (1, 2),
        TYPE: PyTorchTensor
    })
    with pytest.raises(ValidationError):
        validate_abstract(bad_array, {})
示例#2
0
def test_validate_abstract():
    fn = AbstractFunction(
        VirtualFunction((), to_abstract_test(i64)),
        VirtualFunction((), to_abstract_test(f64)),
    )
    with pytest.raises(ValidationError):
        validate_abstract(fn, {})
示例#3
0
def test_validate_abstract_2():
    fn = AbstractFunction(
        VirtualFunction(
            (),
            AbstractArray(to_abstract_test(f64), {
                SHAPE: (1, 2),
                TYPE: PyTorchTensor
            }),
        ), )
    with pytest.raises(ValidationError):
        validate_abstract(fn, {})
示例#4
0
def test_validate_abstract():
    scalar_i64 = to_abstract_test(i64)
    fn = AbstractFunction(
        TypedPrimitive(P.scalar_add, (scalar_i64, scalar_i64), scalar_i64), )
    with pytest.raises(ValidationError):
        validate_abstract(fn, {})