From 96ec5314b43ead2c846d20010d69147c1cfed935 Mon Sep 17 00:00:00 2001 From: ischweer Date: Mon, 20 Jan 2025 19:03:16 -0800 Subject: [PATCH] Lint --- pytensor/link/pytorch/dispatch/basic.py | 2 ++ pytensor/link/pytorch/linker.py | 1 - pytensor/link/utils.py | 4 +--- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pytensor/link/pytorch/dispatch/basic.py b/pytensor/link/pytorch/dispatch/basic.py index 5ec5a366d6..d0626b68ca 100644 --- a/pytensor/link/pytorch/dispatch/basic.py +++ b/pytensor/link/pytorch/dispatch/basic.py @@ -39,10 +39,12 @@ def pytorch_typify_tensor(data, dtype=None, **kwargs): def pytorch_typify_no_conversion_needed(data, **kwargs): return data + @pytorch_typify.register(np.number) def pytorch_typify_extract(data, **kwargs): return data.item() + @singledispatch def pytorch_funcify(op, node=None, storage_map=None, **kwargs): """Create a PyTorch compatible function from an PyTensor `Op`.""" diff --git a/pytensor/link/pytorch/linker.py b/pytensor/link/pytorch/linker.py index 4a5acd5b85..d47aa43dda 100644 --- a/pytensor/link/pytorch/linker.py +++ b/pytensor/link/pytorch/linker.py @@ -51,7 +51,6 @@ class wrapper: """ def __init__(self, fn, gen_functors): - self._fn = fn self.fn = torch.compile(fn) self.gen_functors = gen_functors.copy() diff --git a/pytensor/link/utils.py b/pytensor/link/utils.py index d02398f85b..6b4c2f20f2 100644 --- a/pytensor/link/utils.py +++ b/pytensor/link/utils.py @@ -758,9 +758,7 @@ def fgraph_to_python( new_output_name = unique_name(i) getter_unique_name = unique_name(getter_or_value) global_env[getter_unique_name] = getter_or_value - assign_str = ( - f"{new_output_name} = {getter_unique_name}()" - ) + assign_str = f"{new_output_name} = {getter_unique_name}()" body_assigns.append(assign_str) node_input_names.append(new_output_name) continue