Remove deprecated PyTensor function functionality and reduce overhead#1351
Remove deprecated PyTensor function functionality and reduce overhead#1351ricardoV94 wants to merge 3 commits intopymc-devs:v3from
Conversation
0dc3147 to
782bc2d
Compare
9f026c7 to
4c1f269
Compare
a15d0e5 to
482cded
Compare
482cded to
b5b538f
Compare
2e801bc to
aaf2419
Compare
aaf2419 to
7033561
Compare
|
@ricardoV94 What is this |
|
Something that changed name in #1993 probably, let me find and rerun |
|
Ah dropped during rebase, it was new to this PR?... |
7033561 to
a6fd083
Compare
|
Re-introduced |
d37fd8f to
dc5ad26
Compare
This is actually slower than just not specifying it
dc5ad26 to
867f8b3
Compare
|
Did you mean to add the |
|
Those Ops relied on special casing of inputs being None at runtime (but not typed as such at definition time) which required a general extra |
|
|
||
| # Function.__call__ is responsible for updating the inputs, unless the vm promises to do it itself | ||
| self.update_input_storage: tuple[int, Container] = () | ||
| self._update_input_storage: tuple[int, Container] = () |
There was a problem hiding this comment.
This is a tuple[tuple[int, Container], ...]
There was a problem hiding this comment.
Yeah, I always get tripped by this
|
I understood most of it (not all) and it looks mostly okay to me, except in a couple of places where I have doubts |
Removing all the deprecated stuff that nobody uses
I think after this there's not much more fat to trim. We could try to avoid the input/output list thing with linkers that don't need it but we still need to sort them/ recognize kwargs which is pretty much what's left.
The C part of the call takes 100ns, so the "overhead" in this case is 200-250ns.
For reference, calling
numpy.zeros(100)takes like ~250ns, and a python identity function is ~20ns.Results of the new benchmark
Before
After
I also removed the strict zip, because passing
strict=Falseis more than 100ns slower than not specifying it at all. Check out with this snippet:Closes #1332
Does the same as and closes #1976
📚 Documentation preview 📚: https://pytensor--1351.org.readthedocs.build/en/1351/