File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,11 @@ def replace_in_graph(graph_mod):
4949
5050 # 处理主 gm 及所有嵌套的 GraphModule
5151 modules = [gm ]
52- modules += [m for _ , m in gm .named_modules () if isinstance (m , torch .fx .GraphModule ) and m is not gm ]
52+ modules += [
53+ m
54+ for _ , m in gm .named_modules ()
55+ if isinstance (m , torch .fx .GraphModule ) and m is not gm
56+ ]
5357 for m in modules :
5458 replace_in_graph (m )
5559
@@ -94,11 +98,17 @@ def check_graph(graph_mod):
9498
9599 # 检查主 gm 及所有嵌套的 GraphModule
96100 modules = [gm ]
97- modules += [m for _ , m in gm .named_modules () if isinstance (m , torch .fx .GraphModule ) and m is not gm ]
101+ modules += [
102+ m
103+ for _ , m in gm .named_modules ()
104+ if isinstance (m , torch .fx .GraphModule ) and m is not gm
105+ ]
98106 for m in modules :
99107 check_graph (m )
100108
101- print (f"✅ Model passed: no occurrence of '{ self .unstable_api } ' found in graph nodes." )
109+ print (
110+ f"✅ Model passed: no occurrence of '{ self .unstable_api } ' found in graph nodes."
111+ )
102112
103113 def synchronize (self ):
104114 # Synchronize CUDA operations if available
You can’t perform that action at this time.
0 commit comments