pymc-devs / pymc-devs/pytensor
How to handle `monotonically_increasing/decreasing` attributes on non-unary OPs
@Dekermanjian is already working on this.
Since Jun 29, 2026.
- Dominant language
- Python
- Stars
- 644
- Forks
- 208
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 16
Description
Description
Recently we added monotonically_increasing and monotonically_decreasing attributes to UnaryScalarOP and this brought about a discussion around non-unary scalar operations that may be monotonic like Add/Max.
The two options that I can think off are:
1). move the attributes up onto ScalarOP and keep default as FALSE
2). Define special cases of non-unary scalar ops to have the attributes
I think that option one has the advantage that all ScalarOPS would be consistent with these attributes and would avoid a potential attribute error when something like op.scalar_op.monotonic_increasing is called on a Mul op. The disadvantage being how we define and use monotonicity, will it be monotonic in every input while holding the others fixed?
Option two I think would simpler, but would still require a definition of monotonicity for a non-unary operation.
Resolution to this topic would facilitate the completion of https://github.com/pymc-devs/pymc/issues/8259
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.