def test_transpose2(x, y, axis1, axis2): perm = (scalar_cast(axis1, u64), scalar_cast(axis2, u64)) xt = transpose(x, perm) yt = transpose(y, perm) d = dot(xt, yt) sm = array_reduce(scalar_add, d, ()) return array_to_scalar(sm)
def f(x): return scalar_cast(x, f16)
def test_scalar_cast(x, t): return scalar_cast(x, t)
def test_scalar_cast(): assert isinstance(scalar_cast(1.5, Int[64]), np.int64) assert isinstance(scalar_cast(1.5, Float[16]), np.float16)
def test_scalar_cast(): assert isinstance(scalar_cast(1.5, i64), np.int64) assert isinstance(scalar_cast(1.5, f16), np.float16)