Skip to content

Commit 4d5aca0

Browse files
ArmavicaricardoV94
authored andcommitted
Type function.copy method parameters
1 parent 99589bb commit 4d5aca0

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

pytensor/compile/function/types.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import pytensor.compile.profiling
1515
from pytensor.compile.io import In, SymbolicInput, SymbolicOutput
1616
from pytensor.compile.ops import deep_copy_op, view_op
17+
from pytensor.compile.profiling import ProfileStats
1718
from pytensor.configdefaults import config
1819
from pytensor.graph.basic import (
1920
Constant,
@@ -553,11 +554,11 @@ def __copy__(self):
553554

554555
def copy(
555556
self,
556-
share_memory=False,
557-
swap=None,
558-
delete_updates=False,
559-
name=None,
560-
profile=None,
557+
share_memory: bool = False,
558+
swap: dict | None = None,
559+
delete_updates: bool = False,
560+
name: str | None = None,
561+
profile: bool | str | ProfileStats | None = None,
561562
):
562563
"""
563564
Copy this function. Copied function will have separated maker and
@@ -584,7 +585,7 @@ def copy(
584585
If provided, will be the name of the new
585586
Function. Otherwise, it will be old + " copy"
586587
587-
profile :
588+
profile : bool | str | ProfileStats | None
588589
as pytensor.function profile parameter
589590
590591
Returns
@@ -723,14 +724,8 @@ def checkSV(sv_ori, sv_rpl):
723724
# reinitialize new maker and create new function
724725
if profile is None:
725726
profile = config.profile or config.print_global_stats
726-
# profile -> True or False
727727
if profile is True:
728-
if name:
729-
message = name
730-
else:
731-
message = str(profile.message) + " copy"
732-
profile = pytensor.compile.profiling.ProfileStats(message=message)
733-
# profile -> object
728+
profile = pytensor.compile.profiling.ProfileStats(message=name)
734729
elif isinstance(profile, str):
735730
profile = pytensor.compile.profiling.ProfileStats(message=profile)
736731

0 commit comments

Comments
 (0)