def check_identity_array_creation(shape, dtype): np_out = _np.identity(n=n, dtype=dtype) mx_out = np.identity(n=n, dtype=dtype) assert same(mx_out.asnumpy(), np_out) if dtype is None: assert mx_out.dtype == _np.float32 assert np_out.dtype == _np.float64
def test_identity(): M = 2**16 data = np.identity(M) assert data.shape == (M, M) assert data[0, 0] == 1 and data[-1, -1] == 1 and data[-1, -2] == 0