Skip to content

Commit

Permalink
Add explicit check for failing ndarray.dot(TensorVariable)
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardoV94 committed Oct 3, 2023
1 parent f84ae58 commit 4869cf1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/tensor/test_variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,12 @@ def test_dot_method():
exp_res = dot(X, y)
assert equal_computations([res], [exp_res])

# This doesn't work. Numpy calls TensorVariable.__rmul__ at some point and everything is messed up
X_val = np.arange(2 * 3).reshape((2, 3))
res = as_tensor(X_val).dot(y)
res = X_val.dot(y)
exp_res = dot(X_val, y)
assert equal_computations([res], [exp_res])
with pytest.raises(AssertionError):
assert equal_computations([res], [exp_res])


def test_infix_matmul_method():
Expand Down

0 comments on commit 4869cf1

Please sign in to comment.