Skip to content

Commit f525c8d

Browse files
committed
cumsum usage example
1 parent 1ca4985 commit f525c8d

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

pytensor/tensor/extra_ops.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,9 +410,18 @@ def cumsum(x, axis=None):
410410
axis
411411
The axis along which the cumulative sum is computed.
412412
The default (None) is to compute the cumsum over the flattened array.
413+
# noqa W293
414+
Example
415+
-------
416+
Usage in PyMC:
413417
418+
.. code-block:: python
414419
415-
.. versionadded:: 0.7
420+
with pm.Model() as model:
421+
x0 = pm.Normal('x0')
422+
x = pm.Normal('x', mu=0, sd=1, shape=10)
423+
# Gaussian random walk
424+
grw = pm.Deterministic('grw', x0 + pm.math.cumsum(x))
416425
417426
"""
418427
return CumOp(axis=axis, mode="add")(x)

0 commit comments

Comments
 (0)