Skip to content

Commit 1e996d3

Browse files
cccclaifacebook-github-bot
authored andcommitted
Fix lint warning
Summary: Was working on D48006877 but run into some unrelated lint warning. Seperate out the changes just to fix lint warning Reviewed By: angelayi Differential Revision: D48042818 fbshipit-source-id: 76e51477d58d4b57949c2f52e1f0d0dcbe3875e8
1 parent 9870e11 commit 1e996d3

File tree

6 files changed

+19
-20
lines changed

6 files changed

+19
-20
lines changed

backends/backend_api.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
from executorch.exir.graph_module import get_control_flow_submodules
2525
from executorch.exir.lowered_backend_module import (
26-
arrange_graph_placeholders,
2726
create_exported_program_from_submodule,
2827
create_submodule_from_nodes,
2928
LoweredBackendModule,

backends/test/test_backends.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ def forward(self, x_raw, h, c):
650650
)
651651

652652
new_res = program_with_delegates.dump_graph_module()(*inputs)
653-
for t1, t2 in zip(new_res, orig_res):
653+
for t1, t2 in zip(new_res, orig_res, strict=True):
654654
self.assertTrue(torch.allclose(t1, t2, atol=1e-03, rtol=1e-03))
655655

656656
# Check the backend delegate
@@ -764,7 +764,7 @@ def forward(self, x_raw, h, c):
764764
)
765765

766766
new_res = traced_with_delegate(*inputs)
767-
for t1, t2 in zip(new_res, orig_res):
767+
for t1, t2 in zip(new_res, orig_res, strict=True):
768768
self.assertTrue(torch.allclose(t1, t2, atol=1e-03, rtol=1e-03))
769769

770770
program_with_delegates = traced_with_delegate.to_executorch(
@@ -785,7 +785,7 @@ def forward(self, x_raw, h, c):
785785
# )
786786

787787
new_res = program_with_delegates.dump_graph_module()(*inputs)
788-
for t1, t2 in zip(new_res, orig_res):
788+
for t1, t2 in zip(new_res, orig_res, strict=True):
789789
self.assertTrue(torch.allclose(t1, t2, atol=1e-03, rtol=1e-03))
790790

791791
# Check the backend delegate

backends/test/test_backends_lifted.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ def forward(self, x_raw, h, c):
647647
)
648648

649649
new_res = program_with_delegates.dump_graph_module()(*inputs)
650-
for t1, t2 in zip(new_res, orig_res):
650+
for t1, t2 in zip(new_res, orig_res, strict=True):
651651
self.assertTrue(torch.allclose(t1, t2, atol=1e-03, rtol=1e-03))
652652

653653
# Check the backend delegate
@@ -759,7 +759,7 @@ def forward(self, x_raw, h, c):
759759
)
760760

761761
new_res = traced_with_delegate(*inputs)
762-
for t1, t2 in zip(new_res, orig_res):
762+
for t1, t2 in zip(new_res, orig_res, strict=True):
763763
self.assertTrue(torch.allclose(t1, t2, atol=1e-03, rtol=1e-03))
764764

765765
program_with_delegates = traced_with_delegate.to_executorch(
@@ -780,7 +780,7 @@ def forward(self, x_raw, h, c):
780780
# )
781781

782782
new_res = program_with_delegates.dump_graph_module()(*inputs)
783-
for t1, t2 in zip(new_res, orig_res):
783+
for t1, t2 in zip(new_res, orig_res, strict=True):
784784
self.assertTrue(torch.allclose(t1, t2, atol=1e-03, rtol=1e-03))
785785

786786
# Check the backend delegate

backends/test/test_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ def partition(
280280

281281
test_lib = Library("test_lib", "DEF")
282282

283+
@staticmethod
283284
@bind_pattern_to_op(
284285
test_lib, "test_q_linear(Tensor x, Tensor weight, Tensor bias) -> Tensor"
285286
)

backends/utils.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,17 @@ def is_same_node(
2828
and (node_left.op == node_right.op)
2929
and (len(node_left.all_input_nodes) == len(node_right.all_input_nodes))
3030
and all(
31-
[
32-
is_same_node(arg_left, arg_right)
33-
for arg_left, arg_right in zip(
34-
node_left.all_input_nodes, node_right.all_input_nodes
35-
)
36-
]
31+
is_same_node(arg_left, arg_right)
32+
for arg_left, arg_right in zip(
33+
node_left.all_input_nodes, node_right.all_input_nodes, strict=True
34+
)
3735
)
3836
):
3937
return False
4038
else:
4139
if len(list(node_left)) != len(list(node_right)):
4240
return False
43-
for n_left, n_right in zip(node_left, node_right):
41+
for n_left, n_right in zip(node_left, node_right, strict=True):
4442
# pyre-fixme[6]: For 1st argument expected `Iterable[Node]` but got `Node`.
4543
# pyre-fixme[6]: For 2nd argument expected `Iterable[Node]` but got `Node`.
4644
if not is_same_node(n_left, n_right):
@@ -57,7 +55,9 @@ def is_identical_graph(
5755
# is not the same.
5856
if len(list(graph_left.graph.nodes)) != len(list(graph_right.graph.nodes)):
5957
return False
60-
for node_left, node_right in zip(graph_left.graph.nodes, graph_right.graph.nodes):
58+
for node_left, node_right in zip(
59+
graph_left.graph.nodes, graph_right.graph.nodes, strict=True
60+
):
6161
if not (is_same_node(node_left, node_right)):
6262
return False
6363
return True

exir/tests/test_serde.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313

1414
import torch
1515
from executorch.backends.backend_api import CompileSpec, to_backend
16-
from executorch.backends.test.backend_with_compiler_demo import ( # noqa
17-
BackendWithCompilerDemo,
18-
)
16+
from executorch.backends.test.backend_with_compiler_demo import BackendWithCompilerDemo
17+
1918
from executorch.backends.test.op_partitioner_demo import AddMulPartitionerDemo
2019
from executorch.exir import EdgeCompileConfig
2120
from executorch.exir.serde.serialize import deserialize, serialize
@@ -40,7 +39,7 @@ def check_ep(
4039
flat_orig_outputs, _ = pytree.tree_flatten(orig_outputs)
4140
flat_loaded_outputs, _ = pytree.tree_flatten(loaded_outputs)
4241

43-
for orig, loaded in zip(flat_orig_outputs, flat_loaded_outputs):
42+
for orig, loaded in zip(flat_orig_outputs, flat_loaded_outputs, strict=True):
4443
self.assertTrue(torch.allclose(orig, loaded))
4544

4645
# pyre-ignore
@@ -118,7 +117,7 @@ def forward(self, x):
118117
max_value = model_inputs[0].shape[0]
119118
compile_specs = [CompileSpec("max_value", bytes([max_value]))]
120119
lowered_sin_module = to_backend(
121-
"BackendWithCompilerDemo", edgeir_m.exported_program, compile_specs
120+
BackendWithCompilerDemo.__name__, edgeir_m.exported_program, compile_specs
122121
)
123122

124123
class CompositeModule(torch.nn.Module):

0 commit comments

Comments
 (0)