@@ -1200,18 +1200,18 @@ def __call__(self, *args):
1200
1200
1201
1201
def pydotprint (
1202
1202
fct ,
1203
- outfile = None ,
1204
- compact = True ,
1205
- format = "png" ,
1206
- with_ids = False ,
1207
- high_contrast = True ,
1203
+ outfile : str | None = None ,
1204
+ compact : bool = True ,
1205
+ format : str = "png" ,
1206
+ with_ids : bool = False ,
1207
+ high_contrast : bool = True ,
1208
1208
cond_highlight = None ,
1209
- colorCodes = None ,
1210
- max_label_size = 70 ,
1211
- scan_graphs = False ,
1212
- var_with_name_simple = False ,
1213
- print_output_file = True ,
1214
- return_image = False ,
1209
+ colorCodes : dict | None = None ,
1210
+ max_label_size : int = 70 ,
1211
+ scan_graphs : bool = False ,
1212
+ var_with_name_simple : bool = False ,
1213
+ print_output_file : bool = True ,
1214
+ return_image : bool = False ,
1215
1215
):
1216
1216
"""Print to a file the graph of a compiled pytensor function's ops. Supports
1217
1217
all pydot output formats, including png and svg.
@@ -1676,7 +1676,9 @@ def get_tag(self):
1676
1676
return rval
1677
1677
1678
1678
1679
- def min_informative_str (obj , indent_level = 0 , _prev_obs = None , _tag_generator = None ):
1679
+ def min_informative_str (
1680
+ obj , indent_level : int = 0 , _prev_obs : dict | None = None , _tag_generator = None
1681
+ ) -> str :
1680
1682
"""
1681
1683
Returns a string specifying to the user what obj is
1682
1684
The string will print out as much of the graph as is needed
@@ -1776,7 +1778,7 @@ def min_informative_str(obj, indent_level=0, _prev_obs=None, _tag_generator=None
1776
1778
return rval
1777
1779
1778
1780
1779
- def var_descriptor (obj , _prev_obs = None , _tag_generator = None ):
1781
+ def var_descriptor (obj , _prev_obs : dict | None = None , _tag_generator = None ) -> str :
1780
1782
"""
1781
1783
Returns a string, with no endlines, fully specifying
1782
1784
how a variable is computed. Does not include any memory
@@ -1832,7 +1834,7 @@ def var_descriptor(obj, _prev_obs=None, _tag_generator=None):
1832
1834
return rval
1833
1835
1834
1836
1835
- def position_independent_str (obj ):
1837
+ def position_independent_str (obj ) -> str :
1836
1838
if isinstance (obj , Variable ):
1837
1839
rval = "pytensor_var"
1838
1840
rval += "{type=" + str (obj .type ) + "}"
@@ -1842,7 +1844,7 @@ def position_independent_str(obj):
1842
1844
return rval
1843
1845
1844
1846
1845
- def hex_digest (x ) :
1847
+ def hex_digest (x : np . ndarray ) -> str :
1846
1848
"""
1847
1849
Returns a short, mostly hexadecimal hash of a numpy ndarray
1848
1850
"""
@@ -1852,8 +1854,8 @@ def hex_digest(x):
1852
1854
# because the buffer interface only exposes the raw data, not
1853
1855
# any info about the semantics of how that data should be arranged
1854
1856
# into a tensor
1855
- rval = rval + "|strides=[" + "," .join (str (stride ) for stride in x .strides ) + "]"
1856
- rval = rval + "|shape=[" + "," .join (str (s ) for s in x .shape ) + "]"
1857
+ rval += "|strides=[" + "," .join (str (stride ) for stride in x .strides ) + "]"
1858
+ rval += "|shape=[" + "," .join (str (s ) for s in x .shape ) + "]"
1857
1859
return rval
1858
1860
1859
1861
0 commit comments