From 3f0cf543c67a806ed66aa9b47313c19907243353 Mon Sep 17 00:00:00 2001
From: Yifan Zhao <yifanz16@illinois.edu>
Date: Tue, 12 Jan 2021 06:45:54 -0600
Subject: [PATCH] Use relative import for all except main

---
 hpvm/projects/onnx_frontend/frontend/codegen_hpvm.py   | 4 ++--
 hpvm/projects/onnx_frontend/frontend/codegen_tensor.py | 4 ++--
 hpvm/projects/onnx_frontend/frontend/graph_builder.py  | 4 ++--
 hpvm/projects/onnx_frontend/frontend/graph_ir.py       | 2 +-
 hpvm/projects/onnx_frontend/{frontend => }/main.py     | 6 +++---
 5 files changed, 10 insertions(+), 10 deletions(-)
 rename hpvm/projects/onnx_frontend/{frontend => }/main.py (95%)

diff --git a/hpvm/projects/onnx_frontend/frontend/codegen_hpvm.py b/hpvm/projects/onnx_frontend/frontend/codegen_hpvm.py
index cd9eac2330..1a130fc30b 100644
--- a/hpvm/projects/onnx_frontend/frontend/codegen_hpvm.py
+++ b/hpvm/projects/onnx_frontend/frontend/codegen_hpvm.py
@@ -4,8 +4,8 @@ from typing import Dict, List, Tuple, Union
 
 import jinja2
 
-from graph_builder import DFG
-from graph_ir import DFGNode, TensorNode, WeightTensor
+from .graph_builder import DFG
+from .graph_ir import DFGNode, TensorNode, WeightTensor
 
 TEMPLATE_FILE = "template_hpvm.cpp"
 loader = jinja2.FileSystemLoader(searchpath=Path(__file__).parent)
diff --git a/hpvm/projects/onnx_frontend/frontend/codegen_tensor.py b/hpvm/projects/onnx_frontend/frontend/codegen_tensor.py
index f0a7310605..c4660b24ba 100644
--- a/hpvm/projects/onnx_frontend/frontend/codegen_tensor.py
+++ b/hpvm/projects/onnx_frontend/frontend/codegen_tensor.py
@@ -3,8 +3,8 @@ from typing import Dict, List
 
 import jinja2
 
-from codegen_hpvm import CodeGen
-from graph_ir import DFGNode, TensorNode
+from .codegen_hpvm import CodeGen
+from .graph_ir import DFGNode, TensorNode
 
 TEMPLATE_FILE = "template_tensor.cpp"
 loader = jinja2.FileSystemLoader(searchpath=Path(__file__).parent)
diff --git a/hpvm/projects/onnx_frontend/frontend/graph_builder.py b/hpvm/projects/onnx_frontend/frontend/graph_builder.py
index 3996b947d2..e8bf86a84a 100644
--- a/hpvm/projects/onnx_frontend/frontend/graph_builder.py
+++ b/hpvm/projects/onnx_frontend/frontend/graph_builder.py
@@ -6,8 +6,8 @@ from typing import Dict, Iterable, List, Optional, Tuple, Union
 import networkx as nx
 import onnx
 
-import graph_ir as g
-from onnx_attr import node_attr_to_dict
+from . import graph_ir as g
+from .onnx_attr import node_attr_to_dict
 
 GraphT = onnx.GraphProto
 NodeT = onnx.NodeProto
diff --git a/hpvm/projects/onnx_frontend/frontend/graph_ir.py b/hpvm/projects/onnx_frontend/frontend/graph_ir.py
index fd42617f60..f567ddafed 100644
--- a/hpvm/projects/onnx_frontend/frontend/graph_ir.py
+++ b/hpvm/projects/onnx_frontend/frontend/graph_ir.py
@@ -4,7 +4,7 @@ from typing import List, Tuple
 
 import onnx
 
-from onnx_attr import node_attr_to_dict
+from .onnx_attr import node_attr_to_dict
 
 
 class DFGNode(abc.ABC):
diff --git a/hpvm/projects/onnx_frontend/frontend/main.py b/hpvm/projects/onnx_frontend/main.py
similarity index 95%
rename from hpvm/projects/onnx_frontend/frontend/main.py
rename to hpvm/projects/onnx_frontend/main.py
index d3037224ac..07b5bb7249 100644
--- a/hpvm/projects/onnx_frontend/frontend/main.py
+++ b/hpvm/projects/onnx_frontend/main.py
@@ -32,9 +32,9 @@ def compile(
     opset: Optional[int],
     hpvmc: bool,
 ):
-    from graph_builder import DFG
-    from codegen_tensor import TensorCodeGen
-    from codegen_hpvm import HpvmCodeGen
+    from frontend.graph_builder import DFG
+    from frontend.codegen_tensor import TensorCodeGen
+    from frontend.codegen_hpvm import HpvmCodeGen
 
     model = onnx.load(onnx_file)
     if opset is not None:
-- 
GitLab