File tree Expand file tree Collapse file tree 2 files changed +3
-19
lines changed
pytensor/compile/function Expand file tree Collapse file tree 2 files changed +3
-19
lines changed Original file line number Diff line number Diff line change @@ -275,23 +275,6 @@ def opt_log1p(node):
275275 else :
276276 output_keys = None
277277
278- if name is None :
279- # Determine possible file names
280- source_file = re .sub (r"\.pyc?" , ".py" , __file__ )
281- compiled_file = source_file + "c"
282-
283- stack = tb .extract_stack ()
284- idx = len (stack ) - 1
285-
286- last_frame = stack [idx ]
287- if last_frame [0 ] == source_file or last_frame [0 ] == compiled_file :
288- func_frame = stack [idx - 1 ]
289- while "pytensor/graph" in func_frame [0 ] and idx > 0 :
290- idx -= 1
291- # This can happen if we call var.eval()
292- func_frame = stack [idx - 1 ]
293- name = func_frame [0 ] + ":" + str (func_frame [1 ])
294-
295278 if updates is None :
296279 updates = []
297280
Original file line number Diff line number Diff line change @@ -47,8 +47,9 @@ def test_function_dump():
4747def test_function_name ():
4848 x = vector ("x" )
4949 func = function ([x ], x + 1.0 )
50-
51- assert __file__ in func .name
50+ assert func .name is None
51+ func = function ([x ], x + 1.0 , name = "my_func" )
52+ assert func .name == "my_func"
5253
5354
5455def test_trust_input ():
You can’t perform that action at this time.
0 commit comments