Skip to content

Commit d220c95

Browse files
committed
Run lint
1 parent bc575c9 commit d220c95

File tree

3 files changed

+27
-9
lines changed

3 files changed

+27
-9
lines changed

onnxscript/_internal/builder.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,7 @@ def build_graph(
214214
class GraphBuilder:
215215
"""Imperative builder for constructing ONNX IR graphs with automatic constant promotion, type casting, and shape inference."""
216216

217-
def __init__(
218-
self, graph: ir.Graph, parent: GraphBuilder | None = None
219-
) -> None:
217+
def __init__(self, graph: ir.Graph, parent: GraphBuilder | None = None) -> None:
220218
self._graph = graph
221219
self._parent = parent
222220
self._root: GraphBuilder = parent._root if parent is not None else self

onnxscript/_internal/builder_test.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,11 @@ def test_build_graph_custom_name(self):
10641064
def test_build_graph_with_parent(self):
10651065
"""build_graph with parent sets root on the sub-builder."""
10661066
parent_graph = ir.Graph(
1067-
name="main", inputs=[], outputs=[], nodes=[], opset_imports={"": 23},
1067+
name="main",
1068+
inputs=[],
1069+
outputs=[],
1070+
nodes=[],
1071+
opset_imports={"": 23},
10681072
)
10691073
parent_builder = builder.GraphBuilder(parent_graph)
10701074

@@ -1083,7 +1087,11 @@ def body(op, x):
10831087
def test_subgraph_sets_parent_and_root(self):
10841088
"""GraphBuilder.subgraph() sets parent=self on the sub-builder."""
10851089
parent_graph = ir.Graph(
1086-
name="main", inputs=[], outputs=[], nodes=[], opset_imports={"": 23},
1090+
name="main",
1091+
inputs=[],
1092+
outputs=[],
1093+
nodes=[],
1094+
opset_imports={"": 23},
10871095
)
10881096
parent_builder = builder.GraphBuilder(parent_graph)
10891097

@@ -1097,7 +1105,11 @@ def body(op, x):
10971105
def test_root_graph_builder_is_its_own_root(self):
10981106
"""A top-level GraphBuilder has root == self."""
10991107
graph = ir.Graph(
1100-
name="main", inputs=[], outputs=[], nodes=[], opset_imports={"": 23},
1108+
name="main",
1109+
inputs=[],
1110+
outputs=[],
1111+
nodes=[],
1112+
opset_imports={"": 23},
11011113
)
11021114
gb = builder.GraphBuilder(graph)
11031115
self.assertIs(gb.root, gb)

onnxscript/nn/_module_test.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,15 @@ def test_realize_qualifies_name(self):
7474

7575
def test_realize_in_subgraph_registers_in_root(self):
7676
"""Parameter realized inside a subgraph builder is stored in the root graph."""
77-
from onnxscript._internal.builder import GraphBuilder, build_graph
77+
from onnxscript._internal.builder import GraphBuilder
7878
from onnxscript.onnx_types import FLOAT
7979

8080
root_graph = ir.Graph(
81-
name="main", inputs=[], outputs=[], nodes=[], opset_imports={"": 23},
81+
name="main",
82+
inputs=[],
83+
outputs=[],
84+
nodes=[],
85+
opset_imports={"": 23},
8286
)
8387
root_builder = GraphBuilder(root_graph)
8488

@@ -106,7 +110,11 @@ def test_realize_in_nested_subgraph_registers_in_root(self):
106110
from onnxscript.onnx_types import FLOAT
107111

108112
root_graph = ir.Graph(
109-
name="main", inputs=[], outputs=[], nodes=[], opset_imports={"": 23},
113+
name="main",
114+
inputs=[],
115+
outputs=[],
116+
nodes=[],
117+
opset_imports={"": 23},
110118
)
111119
root_builder = GraphBuilder(root_graph)
112120

0 commit comments

Comments
 (0)