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]])
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} )