def test_scalar_to_array(): a = scalar_to_array(1, AA) assert isinstance(a, np.ndarray) assert a.dtype == np.int64 b = scalar_to_array(1.5, AA) assert isinstance(b, np.ndarray) assert b.dtype == np.float64
def test_array_operations_distribute(x, y): xs = distribute(scalar_to_array(x, AA), (4, 3)) ys = distribute(scalar_to_array(y, AA), (4, 3)) div = array_map(scalar_div, xs, ys) sm = array_reduce(scalar_add, div, ()) return array_to_scalar(sm)
def test_to_array(x): return scalar_to_array(x, AN)
def up1(x2): return array_map( scalar_add, x2, distribute(scalar_to_array(1, typeof(x)), shape(x)), )
def after(xs): return distribute(scalar_to_array(3, arr_t), shape(xs))