Skip to content

Commit 2948525

Browse files
jessegrabowskiricardoV94
authored andcommitted
Ignore axis argument in numba CumOp when input is 1d
1 parent ab5037e commit 2948525

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

pytensor/link/numba/dispatch/extra_ops.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def numba_funcify_CumOp(op: CumOp, node: Apply, **kwargs):
4949

5050
@numba_basic.numba_njit
5151
def cumop(x):
52-
return np.cumsum(x, axis=axis)
52+
return np.cumsum(x)
5353

5454
else:
5555

@@ -73,7 +73,7 @@ def cumop(x):
7373

7474
@numba_basic.numba_njit
7575
def cumop(x):
76-
return np.cumprod(x, axis=axis)
76+
return np.cumprod(x)
7777

7878
else:
7979

tests/link/numba/test_extra_ops.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,17 @@ def test_Bartlett(val):
5858
1,
5959
"mul",
6060
),
61+
# Regression tests for https://github.com/pymc-devs/pytensor/issues/1689
62+
(
63+
(pt.vector(), np.arange(6, dtype=config.floatX)),
64+
0,
65+
"add",
66+
),
67+
(
68+
(pt.vector(), np.arange(6, dtype=config.floatX)),
69+
0,
70+
"mul",
71+
),
6172
],
6273
)
6374
def test_CumOp(val, axis, mode):

0 commit comments

Comments
 (0)