def test_subtraction_with_out(): a = D.array([1.0]) out = D.zeros((1, )) D.sub(a, a, out=out) assert (D.all(out == D.array([0.0])))
def test_eye_asymm_with_out(): out = D.zeros((5, 2)) D.eye(5, 2, out=out) assert (np.all(np.eye(5, 2) == out.cpu().numpy()))
def do(self, A): with pytest.raises(np.linalg.LinAlgError): D.matrix_inv(D.zeros((2, 3))) with pytest.raises(np.linalg.LinAlgError): D.matrix_inv(D.zeros((5, 2, 3)))
def test_eye_with_out(): out = D.zeros((5, 5)) D.eye(5, out=out) assert (np.all(np.eye(5) == out.cpu().numpy()))
def test_matrix_inv_exceptions(): with pytest.raises(np.linalg.LinAlgError): D.matrix_inv(D.zeros((2, 3), dtype=D.float64)) with pytest.raises(np.linalg.LinAlgError): D.matrix_inv(D.zeros((5, 2, 3), dtype=D.float64))