14
14
import pytensor .compile .profiling
15
15
from pytensor .compile .io import In , SymbolicInput , SymbolicOutput
16
16
from pytensor .compile .ops import deep_copy_op , view_op
17
+ from pytensor .compile .profiling import ProfileStats
17
18
from pytensor .configdefaults import config
18
19
from pytensor .graph .basic import (
19
20
Constant ,
@@ -553,11 +554,11 @@ def __copy__(self):
553
554
554
555
def copy (
555
556
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 ,
561
562
):
562
563
"""
563
564
Copy this function. Copied function will have separated maker and
@@ -584,7 +585,7 @@ def copy(
584
585
If provided, will be the name of the new
585
586
Function. Otherwise, it will be old + " copy"
586
587
587
- profile :
588
+ profile : bool | str | ProfileStats | None
588
589
as pytensor.function profile parameter
589
590
590
591
Returns
@@ -723,14 +724,8 @@ def checkSV(sv_ori, sv_rpl):
723
724
# reinitialize new maker and create new function
724
725
if profile is None :
725
726
profile = config .profile or config .print_global_stats
726
- # profile -> True or False
727
727
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 )
734
729
elif isinstance (profile , str ):
735
730
profile = pytensor .compile .profiling .ProfileStats (message = profile )
736
731
0 commit comments