Skip to content

Commit 89ec7ea

Browse files
committed
modify codestyle
1 parent c15716b commit 89ec7ea

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

graph_net/torch/backend/unstable_to_stable_backend.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)