コード例 #1
0
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])))
コード例 #2
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()))
コード例 #3
0
 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)))
コード例 #4
0
def test_eye_with_out():
    out = D.zeros((5, 5))
    D.eye(5, out=out)
    assert (np.all(np.eye(5) == out.cpu().numpy()))
コード例 #5
0
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))