-
Notifications
You must be signed in to change notification settings - Fork 148
Simplify the Function class #955
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
HangenYuu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the current parameters to pytensor.function():
inputs: Iterable[Variable]outputs: Variable | Iterable[Variable] | dict[str, Variable] | None = Nonemode: str | Mode | None = Noneupdates: Iterable[tuple[Variable, Variable]] | dict[Variable, Variable] | None = Nonegivens: Iterable[tuple[Variable, Variable]] | dict[Variable, Variable] | None = Noneno_default_updates: bool = Falseaccept_inplace: bool = Falsename: str | None = Nonerebuild_strict: bool = Trueallow_input_downcast: bool | None = Noneprofile: bool | ProfileStats | None = Noneon_unused_input: str | None = None
The ones I propose to remove and use a default value are
accept_inplace:FalseNo inplace ops by default.rebuild_strict:Trueby default.allow_input_downcast:Noneby default.profile:Noneby default.on_unused_input:Noneby default.
I also want to ask about givens and no_default_updates since I have never used them before (givens seem unremoveable though).
Those are all still useful, unfortunately. There's a getattr in call that we can remove according to the comment about being there for old pickles |
Oh wait, then what did you mean here in #552 🫤 |
https://pytensor.readthedocs.io/en/latest/library/compile/io.html#value-initial-and-default-values |
Oh so you meant to remove |
HangenYuu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I realized 2 things that output_keys will create output_subset behind the scene. So removing output_subset means that I also need to remove output_keys, together with the tests testing for them e.g., test_partial_function_with_output_keys. Is this okay?
Sounds okay |
Description
Simplify the function class in pytensor.
output_subsetkwargs at call time of classFunctionas no one is using it.pytensor.function()parameters (use default value in codes instead)Related Issue
Checklist
Type of change