Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 75352ad

Browse files
amyreesefacebook-github-bot
authored andcommitted
apply Black 2024 style in fbcode (9/16)
Summary: Formats the covered files with pyfmt. paintitblack Reviewed By: aleivag Differential Revision: D54447729 fbshipit-source-id: fc781322b254f7027c24888cdadd5f1e90325ba8
1 parent 2966e38 commit 75352ad

44 files changed

Lines changed: 152 additions & 106 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

backends/example/example_backend_delegate_passes/permute_memory_formats_pass.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,11 @@ def call( # noqa: suprress function is too complex (13)
127127
# if user is in to_dim_op_set, it means the user's arg is already set to_dim op
128128
if user not in to_dim_op_set:
129129
user_new_arg = [
130-
input_node_map[user_arg]
131-
if user_arg in input_node_map
132-
else user_arg
130+
(
131+
input_node_map[user_arg]
132+
if user_arg in input_node_map
133+
else user_arg
134+
)
133135
for user_arg in user.args
134136
]
135137
# Update input node's users arg

backends/transforms/duplicate_dynamic_quant_chain.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def _replicate_chose_qparam_nodes_for_q_dq(
7777
)
7878
q_dq_pair.append((user, dq_node))
7979

80-
for (q_node, dq_node) in q_dq_pair:
80+
for q_node, dq_node in q_dq_pair:
8181
with gm.graph.inserting_after(get_item_node_1):
8282
new_get_item_node_1 = gm.graph.node_copy(get_item_node_1)
8383
new_get_item_node_2 = gm.graph.node_copy(get_item_node_2)

backends/xnnpack/passes/channels_last_tagged_reshape_pass.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from executorch.exir.dialects._ops import ops as exir_ops
1313
from executorch.exir.pass_base import PassResult
1414

15+
1516
# TODO(T151254305) use subgraph_rewriter
1617
class ChannelsLastTaggedReshapePass(XNNPACKPass):
1718
"""

backends/xnnpack/utils/configs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
)
1414
from executorch.exir.pass_manager import PassType
1515

16+
1617
### XNNPACK Configs ###
1718
def get_xnnpack_edge_compile_config() -> exir.EdgeCompileConfig:
1819
return exir.EdgeCompileConfig(

backends/xnnpack/utils/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
is_param,
2727
)
2828

29+
2930
### XNNPACK Capture ###
3031
def capture_graph_for_xnnpack(
3132
module: torch.nn.Module,

codegen/tools/test/test_gen_oplist.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,9 @@ def test_dump_operator_from_ops_schema_yaml_with_mix_syntax(self) -> None:
231231
self.assertListEqual(sorted(ops.keys()), ["aten::add.out", "aten::mul.out"])
232232

233233
def test_get_kernel_metadata_from_ops_yaml(self) -> None:
234-
metadata: Dict[
235-
str, List[str]
236-
] = gen_oplist._get_et_kernel_metadata_from_ops_yaml(self.ops_schema_yaml)
234+
metadata: Dict[str, List[str]] = (
235+
gen_oplist._get_et_kernel_metadata_from_ops_yaml(self.ops_schema_yaml)
236+
)
237237

238238
self.assertEqual(len(metadata), 2)
239239

examples/models/llama2/export_llama_lib.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,9 +387,9 @@ def _export_llama(modelname, args) -> str: # noqa: C901
387387
# to_backend
388388
partitioners = {}
389389
if pt2e_quant_params is not None and pt2e_quant_params.quantize_linear is not None:
390-
partitioners[
391-
XnnpackDynamicallyQuantizedPartitioner.__name__
392-
] = XnnpackDynamicallyQuantizedPartitioner()
390+
partitioners[XnnpackDynamicallyQuantizedPartitioner.__name__] = (
391+
XnnpackDynamicallyQuantizedPartitioner()
392+
)
393393
modelname = f"xnnpack_dq_{modelname}"
394394

395395
if args.xnnpack:

examples/xtensa/aot/quantizer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def quantize_tensor_multiplier(
4646
result = RoundingRightShift(FixedPointMultiplication(int32_value,
4747
out_multiplier[i]), right_shift[i])
4848
"""
49+
4950
# This is identical to C++11 std::round(). The general python round rounds
5051
# down, and C++ rounds away from zero.
5152
def round_away_zero(f) -> int:

exir/backend/backend_details.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ def enforcedmethod(func):
2121
@dataclass
2222
class PreprocessResult:
2323
processed_bytes: bytes = bytes()
24-
debug_handle_map: Optional[
25-
Union[Dict[int, Tuple[int]], Dict[str, Tuple[int]]]
26-
] = None
24+
debug_handle_map: Optional[Union[Dict[int, Tuple[int]], Dict[str, Tuple[int]]]] = (
25+
None
26+
)
2727

2828

2929
"""

exir/backend/test/backend_with_delegate_mapping_demo.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from torch import nn
1515
from torch.export.exported_program import ExportedProgram
1616

17+
1718
# A simple way to represent an op along with its delegate debug identifier.
1819
class DummyOp:
1920
def __init__(

0 commit comments

Comments
 (0)