Skip to content

Commit f6581ce

Browse files
committed
Add trust_input parameter to function_dump and _Maker class
1 parent e99511f commit f6581ce

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

pytensor/compile/debugmode.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1966,6 +1966,12 @@ class _Maker(FunctionMaker): # inheritance buys a few helper functions
19661966
If the outputs argument for pytensor.function was a list, then
19671967
output_keys is None. If the outputs argument was a dict, then
19681968
output_keys is a sorted list of the keys from that dict.
1969+
trust_input : bool, default False
1970+
If True, no input validation checks are performed when the function is
1971+
called. This includes checking the number of inputs, their types and
1972+
that multiple inputs are not aliased to each other. Failure to meet any
1973+
of these conditions can lead to computational errors or to the
1974+
interpreter crashing.
19691975
19701976
Notes
19711977
-----
@@ -1993,6 +1999,7 @@ def __init__(
19931999
output_keys=None,
19942000
name=None,
19952001
no_fgraph_prep=False,
2002+
trust_input=False,
19962003
):
19972004
self.mode = mode
19982005
self.profile = profile
@@ -2146,6 +2153,7 @@ def __init__(
21462153
self.on_unused_input = on_unused_input # Used for the pickling/copy
21472154
self.output_keys = output_keys
21482155
self.name = name
2156+
self.trust_input = trust_input
21492157

21502158
self.required = [(i.value is None) for i in self.inputs]
21512159
self.refeed = [

pytensor/compile/function/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def function_dump(
3737
profile: bool | ProfileStats | None = None,
3838
on_unused_input: str | None = None,
3939
extra_tag_to_remove: str | None = None,
40+
trust_input: bool = False,
4041
):
4142
"""
4243
This is helpful to make a reproducible case for problems during PyTensor
@@ -82,6 +83,7 @@ def function_dump(
8283
"allow_input_downcast": allow_input_downcast,
8384
"profile": profile,
8485
"on_unused_input": on_unused_input,
86+
"trust_input": trust_input,
8587
}
8688
with Path(filename).open("wb") as f:
8789
pickler = pytensor.misc.pkl_utils.StripPickler(

0 commit comments

Comments
 (0)