Skip to content

Commit

Permalink
Deprecate rarely used Function functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardoV94 committed Oct 10, 2024
1 parent b7eb139 commit 02cea48
Show file tree
Hide file tree
Showing 2 changed files with 190 additions and 130 deletions.
18 changes: 9 additions & 9 deletions pytensor/compile/function/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,9 @@ def __init__(
self.nodes_with_inner_function = []
self.output_keys = output_keys

if self.output_keys is not None:
warnings.warn("output_keys is deprecated.", FutureWarning)

assert len(self.output_storage) == len(self.maker.fgraph.outputs)

# See if we have any mutable / borrow inputs
Expand Down Expand Up @@ -810,20 +813,15 @@ def __call__(self, *args, **kwargs):
if ``output_subset`` is not passed.
"""

def restore_defaults():
for i, (required, refeed, value) in enumerate(self.defaults):
if refeed:
if isinstance(value, Container):
value = value.storage[0]
self[i] = value

profile = self.profile
if profile:
t0 = time.perf_counter()

output_subset = kwargs.pop("output_subset", None)
if output_subset is not None and self.output_keys is not None:
output_subset = [self.output_keys.index(key) for key in output_subset]
if output_subset is not None:
warnings.warn("output_subset is deprecated.", FutureWarning)
if self.output_keys is not None:
output_subset = [self.output_keys.index(key) for key in output_subset]

# Reinitialize each container's 'provided' counter
if self.trust_input:
Expand Down Expand Up @@ -1565,6 +1563,8 @@ def __init__(
)
for i in self.inputs
]
if any(self.refeed):
warnings.warn("Inputs with default values are deprecated.", FutureWarning)

def create(self, input_storage=None, storage_map=None):
"""
Expand Down
Loading

0 comments on commit 02cea48

Please sign in to comment.