Skip to content

Commit 0912de1

Browse files
committed
fix whitespaces for type annotations according to pep
Signed-off-by: dchigarev <dmitry.chigarev@intel.com>
1 parent aafffef commit 0912de1

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

python/examples/ingress/torch/01-dummy-mlp-from-file.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
# - Loads the DummyMLP class and instantiates it with arguments obtained from 'get_init_inputs()'
3333
# - Calls get_sample_inputs() to get sample input tensors for shape inference
3434
# - Converts PyTorch model to linalg-on-tensors dialect operations using torch_mlir
35-
mlir_module_ir : ir.Module = import_from_file(
35+
mlir_module_ir: ir.Module = import_from_file(
3636
model_path, # Path to the Python file containing the model
3737
model_class_name="DummyMLP", # Name of the PyTorch nn.Module class to convert
3838
init_args_fn_name="get_init_inputs", # Function that returns args for model.__init__()
@@ -48,7 +48,7 @@
4848
# also be done with the MLIR module.
4949

5050
# Step 3: Extract the main function operation from the MLIR module and print its metadata
51-
func_op : func.FuncOp = mlir_module_ir.operation.regions[0].blocks[0].operations[0]
51+
func_op: func.FuncOp = mlir_module_ir.operation.regions[0].blocks[0].operations[0]
5252
print(f"entry-point name: {func_op.name}")
5353
print(f"entry-point type: {func_op.type}")
5454

python/examples/ingress/torch/02-dummy-mlp-from-model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
ir_context = ir.Context()
3030
# Step 2: Convert the PyTorch model to MLIR
31-
mlir_module_ir : ir.Module = import_from_model(
31+
mlir_module_ir: ir.Module = import_from_model(
3232
model,
3333
sample_args=(sample_input,),
3434
ir_context=ir_context
@@ -41,7 +41,7 @@
4141
# also be done with the MLIR module.
4242

4343
# Step 3: Extract the main function operation from the MLIR module and print its metadata
44-
func_op : func.FuncOp = mlir_module_ir.operation.regions[0].blocks[0].operations[0]
44+
func_op: func.FuncOp = mlir_module_ir.operation.regions[0].blocks[0].operations[0]
4545
print(f"entry-point name: {func_op.name}")
4646
print(f"entry-point type: {func_op.type}")
4747

python/lighthouse/ingress/torch/torch_import.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727

2828
def import_from_model(
2929
model: nn.Module,
30-
sample_args : Iterable,
31-
sample_kwargs : Mapping = None,
32-
dialect : OutputType | str = OutputType.LINALG_ON_TENSORS,
33-
ir_context : ir.Context | None = None,
30+
sample_args: Iterable,
31+
sample_kwargs: Mapping = None,
32+
dialect: OutputType | str = OutputType.LINALG_ON_TENSORS,
33+
ir_context: ir.Context | None = None,
3434
**kwargs,
3535
) -> str | ir.Module:
3636
"""Import a PyTorch nn.Module into MLIR.
@@ -100,9 +100,9 @@ def import_from_file(
100100
init_kwargs_fn_name: str | None = None,
101101
sample_args_fn_name: str = "get_inputs",
102102
sample_kwargs_fn_name: str | None = None,
103-
state_path : str | Path | None = None,
104-
dialect : OutputType | str = OutputType.LINALG_ON_TENSORS,
105-
ir_context : ir.Context | None = None,
103+
state_path: str | Path | None = None,
104+
dialect: OutputType | str = OutputType.LINALG_ON_TENSORS,
105+
ir_context: ir.Context | None = None,
106106
**kwargs,
107107
) -> str | ir.Module:
108108
"""Load a PyTorch nn.Module from a file and import it into MLIR.
@@ -211,7 +211,7 @@ def get_inputs():
211211
error_msg=f"Sample kwargs function '{sample_kwargs_fn_name}' not found in {filepath}"
212212
)
213213

214-
nn_model : nn.Module = model(*model_init_args, **model_init_kwargs)
214+
nn_model: nn.Module = model(*model_init_args, **model_init_kwargs)
215215
if state_path is not None:
216216
state_dict = torch.load(state_path)
217217
nn_model.load_state_dict(state_dict)

0 commit comments

Comments
 (0)