示例#1
0
def test_type_conversions():
    assert np_dtype_to_type('float32') is Float[32]

    with pytest.raises(TypeError):
        np_dtype_to_type('float80')

    assert type_to_np_dtype(Float[16]) == 'float16'

    with pytest.raises(TypeError):
        type_to_np_dtype(List[Int[64]])
示例#2
0
def to_abstract_test(self, x: np.ndarray):
    return AbstractArray(
        AbstractScalar({
            VALUE: ANYTHING,
            TYPE: dtype.np_dtype_to_type(str(x.dtype)),
        }),
        {SHAPE: x.shape}
    )