Skip to content

Commit 11efcda

Browse files
[python] Make module imports relative in fx.py and compiler_utils.py (llvm#3925)
This PR makes module imports relative in `fx.py` and `compiler_utils.py`. When torch-mlir python package is embedded into python package of other MLIR based project, there won't be `torch_mlir` top level package for absolute import.
1 parent 4a2cbb9 commit 11efcda

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

python/torch_mlir/compiler_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
from typing import Union, List
1111

1212
import torch
13-
from torch_mlir.passmanager import PassManager
14-
from torch_mlir.ir import StringAttr
13+
from .passmanager import PassManager
14+
from .ir import StringAttr
1515

1616

1717
class TensorPlaceholder:

python/torch_mlir/fx.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
import torch.nn as nn
1414
from torch.export import ExportedProgram
1515

16-
from torch_mlir.extras.fx_importer import FxImporter, FxImporterHooks
17-
from torch_mlir import ir
18-
from torch_mlir.dialects import torch as torch_d
19-
from torch_mlir.extras.fx_decomp_util import get_decomposition_table
20-
from torch_mlir.compiler_utils import (
16+
from .extras.fx_importer import FxImporter, FxImporterHooks
17+
from . import ir
18+
from .dialects import torch as torch_d
19+
from .extras.fx_decomp_util import get_decomposition_table
20+
from .compiler_utils import (
2121
OutputType,
2222
run_pipeline_with_repro_report,
2323
lower_mlir_module,

0 commit comments

Comments
 (0)