diff --git a/apps/android_camera/models/prepare_model.py b/apps/android_camera/models/prepare_model.py index 19be368c97e9..ab20e028c2ad 100644 --- a/apps/android_camera/models/prepare_model.py +++ b/apps/android_camera/models/prepare_model.py @@ -25,7 +25,7 @@ import tvm import tvm.relay as relay -from tvm.contrib import util, ndk, graph_runtime as runtime +from tvm.contrib import utils, ndk, graph_runtime as runtime from tvm.contrib.download import download_testdata, download target = "llvm -mtriple=arm64-linux-android" diff --git a/apps/android_rpc/tests/android_rpc_test.py b/apps/android_rpc/tests/android_rpc_test.py index 2827c140ea92..9586bffeca0b 100644 --- a/apps/android_rpc/tests/android_rpc_test.py +++ b/apps/android_rpc/tests/android_rpc_test.py @@ -25,7 +25,7 @@ from tvm import te import os from tvm import rpc -from tvm.contrib import util, ndk +from tvm.contrib import utils, ndk import numpy as np # Set to be address of tvm proxy. @@ -50,7 +50,7 @@ def test_rpc_module(): A = te.placeholder((n,), name="A") B = te.compute(A.shape, lambda *i: A(*i) + 1.0, name="B") a_np = np.random.uniform(size=1024).astype(A.dtype) - temp = util.tempdir() + temp = utils.tempdir() # Establish remote connection with target hardware tracker = rpc.connect_tracker(tracker_host, tracker_port) diff --git a/apps/benchmark/arm_cpu_imagenet_bench.py b/apps/benchmark/arm_cpu_imagenet_bench.py index fb58819d3c5c..e7233370e6d6 100644 --- a/apps/benchmark/arm_cpu_imagenet_bench.py +++ b/apps/benchmark/arm_cpu_imagenet_bench.py @@ -23,7 +23,7 @@ import tvm from tvm import te -from tvm.contrib.util import tempdir +from tvm.contrib.utils import tempdir import tvm.contrib.graph_runtime as runtime from tvm import relay diff --git a/apps/benchmark/mobile_gpu_imagenet_bench.py b/apps/benchmark/mobile_gpu_imagenet_bench.py index b57f6028ab73..cf78c66141d0 100644 --- a/apps/benchmark/mobile_gpu_imagenet_bench.py +++ b/apps/benchmark/mobile_gpu_imagenet_bench.py @@ -23,7 +23,7 @@ import tvm from tvm import te -from tvm.contrib.util import tempdir +from tvm.contrib.utils import tempdir import tvm.contrib.graph_runtime as runtime from tvm import relay diff --git a/apps/ios_rpc/tests/ios_rpc_mobilenet.py b/apps/ios_rpc/tests/ios_rpc_mobilenet.py index 132377ac4412..90ac6bfb9218 100644 --- a/apps/ios_rpc/tests/ios_rpc_mobilenet.py +++ b/apps/ios_rpc/tests/ios_rpc_mobilenet.py @@ -22,7 +22,7 @@ from tvm.relay import transform from tvm.relay.op.annotation import compiler_begin, compiler_end from tvm.relay.quantize.quantize import prerequisite_optimize -from tvm.contrib import util, xcode, graph_runtime, coreml_runtime +from tvm.contrib import utils, xcode, graph_runtime, coreml_runtime from tvm.contrib.target import coreml as _coreml import os @@ -98,7 +98,7 @@ def get_model(model_name, data_shape): def test_mobilenet(): - temp = util.tempdir() + temp = utils.tempdir() image, synset = prepare_input() model, params = get_model("mobilenetv2_1.0", image.shape) diff --git a/apps/ios_rpc/tests/ios_rpc_test.py b/apps/ios_rpc/tests/ios_rpc_test.py index 620fe493771f..a967c2f75e61 100644 --- a/apps/ios_rpc/tests/ios_rpc_test.py +++ b/apps/ios_rpc/tests/ios_rpc_test.py @@ -26,7 +26,7 @@ import re import sys from tvm import rpc -from tvm.contrib import util, xcode +from tvm.contrib import utils, xcode import numpy as np # Set to be address of tvm proxy. @@ -59,7 +59,7 @@ def test_rpc_module(): n = tvm.runtime.convert(1024) A = te.placeholder((n,), name="A") B = te.compute(A.shape, lambda *i: A(*i) + 1.0, name="B") - temp = util.tempdir() + temp = utils.tempdir() s = te.create_schedule(B.op) xo, xi = s[B].split(B.op.axis[0], factor=64) s[B].bind(xi, te.thread_axis("threadIdx.x")) diff --git a/apps/topi_recipe/conv/depthwise_conv2d_test.py b/apps/topi_recipe/conv/depthwise_conv2d_test.py index 036f1a4240f2..94687edde5f9 100644 --- a/apps/topi_recipe/conv/depthwise_conv2d_test.py +++ b/apps/topi_recipe/conv/depthwise_conv2d_test.py @@ -22,7 +22,7 @@ from tvm.contrib import nvcc from tvm import topi -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple from tvm.topi.cuda.depthwise_conv2d import ( schedule_depthwise_conv2d_nchw, schedule_depthwise_conv2d_nhwc, diff --git a/apps/topi_recipe/conv/test_conv2d_hwcn_map.py b/apps/topi_recipe/conv/test_conv2d_hwcn_map.py index 1d2032d5c405..d67bfdc8952e 100644 --- a/apps/topi_recipe/conv/test_conv2d_hwcn_map.py +++ b/apps/topi_recipe/conv/test_conv2d_hwcn_map.py @@ -22,7 +22,7 @@ from tvm import te from tvm.contrib import nvcc from tvm import topi -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple TASK = "conv2d_hwcn_map" USE_MANUAL_CODE = False diff --git a/apps/topi_recipe/gemm/android_gemm_square.py b/apps/topi_recipe/gemm/android_gemm_square.py index 522818842cfa..0e64dcd3844d 100644 --- a/apps/topi_recipe/gemm/android_gemm_square.py +++ b/apps/topi_recipe/gemm/android_gemm_square.py @@ -19,7 +19,7 @@ from tvm import te import os from tvm import rpc -from tvm.contrib import util, ndk +from tvm.contrib import utils, ndk import numpy as np # Set to be address of tvm proxy. @@ -121,7 +121,7 @@ def test_gemm_gpu(N, times, bn, num_block, num_thread): print(tvm.lower(s, [A, B, C], simple_mode=True)) f = tvm.build(s, [A, B, C], "opencl", target_host=target, name="gemm_gpu") - temp = util.tempdir() + temp = utils.tempdir() path_dso = temp.relpath("gemm_gpu.so") f.export_library(path_dso, ndk.create_shared) diff --git a/docs/api/python/contrib.rst b/docs/api/python/contrib.rst index 8ac4e1ff7d3a..0eb3024c2d08 100644 --- a/docs/api/python/contrib.rst +++ b/docs/api/python/contrib.rst @@ -122,9 +122,9 @@ tvm.contrib.tar :members: -tvm.contrib.util -~~~~~~~~~~~~~~~~ -.. automodule:: tvm.contrib.util +tvm.contrib.utils +~~~~~~~~~~~~~~~~~ +.. automodule:: tvm.contrib.utils :members: diff --git a/docs/dev/introduction_to_module_serialization.rst b/docs/dev/introduction_to_module_serialization.rst index 5451b84c9b8c..6b2f2addaf9a 100644 --- a/docs/dev/introduction_to_module_serialization.rst +++ b/docs/dev/introduction_to_module_serialization.rst @@ -32,7 +32,7 @@ Let us build one ResNet-18 workload for GPU as an example first. from tvm import relay from tvm.relay import testing - from tvm.contrib import util + from tvm.contrib import utils import tvm # Resnet18 workload @@ -43,7 +43,7 @@ Let us build one ResNet-18 workload for GPU as an example first. _, resnet18_lib, _ = relay.build_module.build(resnet18_mod, "cuda", params=resnet18_params) # create one tempory directory - temp = util.tempdir() + temp = utils.tempdir() # path lib file_name = "deploy.so" diff --git a/golang/sample/deploy.py b/golang/sample/deploy.py index a0553cfe0211..98820195511c 100644 --- a/golang/sample/deploy.py +++ b/golang/sample/deploy.py @@ -51,7 +51,7 @@ # Save Compiled Module # -------------------- from tvm.contrib import cc -from tvm.contrib import util +from tvm.contrib import utils fadd.save("deploy.o") cc.create_shared("deploy.so", ["deploy.o"]) diff --git a/golang/src/util.go b/golang/src/utils.go similarity index 98% rename from golang/src/util.go rename to golang/src/utils.go index d3846d1db452..2da4138a1e66 100644 --- a/golang/src/util.go +++ b/golang/src/utils.go @@ -19,7 +19,7 @@ /*! * \brief gotvm package source for common utilities - * \file util.go + * \file utils.go */ package gotvm diff --git a/jvm/README.md b/jvm/README.md index 348e941c16e4..320e769adb74 100644 --- a/jvm/README.md +++ b/jvm/README.md @@ -97,7 +97,7 @@ There's nothing special for this part. The following Python snippet generate add import os import tvm from tvm import te -from tvm.contrib import cc, util +from tvm.contrib import cc, utils def test_add(target_dir): n = te.var("n") diff --git a/jvm/core/src/test/scripts/test_add_cpu.py b/jvm/core/src/test/scripts/test_add_cpu.py index 40edd082466a..4725dcb8aa67 100644 --- a/jvm/core/src/test/scripts/test_add_cpu.py +++ b/jvm/core/src/test/scripts/test_add_cpu.py @@ -18,7 +18,7 @@ import tvm from tvm import te -from tvm.contrib import cc, util +from tvm.contrib import cc, utils def test_add(target_dir): diff --git a/jvm/core/src/test/scripts/test_add_gpu.py b/jvm/core/src/test/scripts/test_add_gpu.py index 7983930252bc..040a447c3c27 100644 --- a/jvm/core/src/test/scripts/test_add_gpu.py +++ b/jvm/core/src/test/scripts/test_add_gpu.py @@ -18,7 +18,7 @@ import tvm from tvm import te -from tvm.contrib import cc, util +from tvm.contrib import cc, utils def test_add(target_dir): diff --git a/python/setup.py b/python/setup.py index 24022e4ec7b5..5333da0da239 100644 --- a/python/setup.py +++ b/python/setup.py @@ -16,7 +16,6 @@ # under the License. # pylint: disable=invalid-name, exec-used """Setup TVM package.""" -from __future__ import absolute_import import os import shutil import sys diff --git a/python/tvm/auto_scheduler/auto_schedule.py b/python/tvm/auto_scheduler/auto_schedule.py index a53c29d174d7..5bc13fec62a9 100644 --- a/python/tvm/auto_scheduler/auto_schedule.py +++ b/python/tvm/auto_scheduler/auto_schedule.py @@ -36,7 +36,7 @@ class HardwareParams(Object): """The parameters of target hardware used to guide the search policy TODO(jcf94): This is considered to be merged with the new Target specification: - https://discuss.tvm.ai/t/rfc-tvm-target-specification/6844 + https://discuss.tvm.apache.org/t/rfc-tvm-target-specification/6844 Parameters ---------- diff --git a/python/tvm/autotvm/__init__.py b/python/tvm/autotvm/__init__.py index 7eb1c8b98bc2..a3c59252b01a 100644 --- a/python/tvm/autotvm/__init__.py +++ b/python/tvm/autotvm/__init__.py @@ -33,7 +33,7 @@ from . import record from . import task from . import tuner -from . import util +from . import utils from . import env from . import tophub diff --git a/python/tvm/autotvm/graph_tuner/base_graph_tuner.py b/python/tvm/autotvm/graph_tuner/base_graph_tuner.py index 40945edad57f..741b05f4c453 100644 --- a/python/tvm/autotvm/graph_tuner/base_graph_tuner.py +++ b/python/tvm/autotvm/graph_tuner/base_graph_tuner.py @@ -509,7 +509,7 @@ def _callback(_, inputs, results): # Rule out invalid layout transformations out = topi.layout_transform(data, in_layout, out_layout) out_flops = 1 - for i in topi.util.get_const_tuple(out.shape): + for i in topi.utils.get_const_tuple(out.shape): out_flops *= i if flops != out_flops: diff --git a/python/tvm/autotvm/measure/measure_methods.py b/python/tvm/autotvm/measure/measure_methods.py index 7032db67a732..913d62b94427 100644 --- a/python/tvm/autotvm/measure/measure_methods.py +++ b/python/tvm/autotvm/measure/measure_methods.py @@ -41,7 +41,7 @@ from tvm.driver import build from tvm.contrib import nvcc, ndk, tar -from ..util import get_const_tuple +from ..utils import get_const_tuple from ..env import AutotvmGlobalScope from ..task.space import InstantiationError diff --git a/python/tvm/autotvm/task/space.py b/python/tvm/autotvm/task/space.py index fb8cf57ed7c7..cf9cd809aa8d 100644 --- a/python/tvm/autotvm/task/space.py +++ b/python/tvm/autotvm/task/space.py @@ -34,7 +34,7 @@ from tvm.te import schedule, thread_axis from tvm.tir import expr -from tvm.autotvm.util import get_const_int +from tvm.autotvm.utils import get_const_int Axis = namedtuple("Axis", ["space", "index"]) diff --git a/python/tvm/autotvm/task/task.py b/python/tvm/autotvm/task/task.py index 8822ba971e4c..c8b50ad33741 100644 --- a/python/tvm/autotvm/task/task.py +++ b/python/tvm/autotvm/task/task.py @@ -29,7 +29,8 @@ from tvm.te import placeholder, tensor from tvm.tir import expr -from ..util import get_const_int, get_const_tuple + +from ..utils import get_const_int, get_const_tuple from .dispatcher import ApplyConfig, DispatchContext from .space import ConfigSpace diff --git a/python/tvm/autotvm/tophub.py b/python/tvm/autotvm/tophub.py index 2076ee7d363c..e3170ba98f8a 100644 --- a/python/tvm/autotvm/tophub.py +++ b/python/tvm/autotvm/tophub.py @@ -30,7 +30,7 @@ from ..target import Target from ..contrib.download import download from .record import load_from_file -from .util import EmptyContext +from .utils import EmptyContext # environment variable to read TopHub location AUTOTVM_TOPHUB_LOC_VAR = "TOPHUB_LOCATION" diff --git a/python/tvm/autotvm/tuner/callback.py b/python/tvm/autotvm/tuner/callback.py index bb9dafaac112..dc75de206d05 100644 --- a/python/tvm/autotvm/tuner/callback.py +++ b/python/tvm/autotvm/tuner/callback.py @@ -23,7 +23,7 @@ import numpy as np from .. import record -from ..util import format_si_prefix +from ..utils import format_si_prefix logger = logging.getLogger("autotvm") diff --git a/python/tvm/autotvm/tuner/metric.py b/python/tvm/autotvm/tuner/metric.py index 1ed04ab22e3f..f6932f80d3e3 100644 --- a/python/tvm/autotvm/tuner/metric.py +++ b/python/tvm/autotvm/tuner/metric.py @@ -19,7 +19,7 @@ import numpy as np -from ..util import get_rank +from ..utils import get_rank def max_curve(trial_scores): diff --git a/python/tvm/autotvm/tuner/sa_model_optimizer.py b/python/tvm/autotvm/tuner/sa_model_optimizer.py index 5535246791b6..401eda8c276f 100644 --- a/python/tvm/autotvm/tuner/sa_model_optimizer.py +++ b/python/tvm/autotvm/tuner/sa_model_optimizer.py @@ -25,7 +25,7 @@ import numpy as np -from ..util import sample_ints +from ..utils import sample_ints from .model_based_tuner import ModelOptimizer, knob2point, point2knob logger = logging.getLogger("autotvm") diff --git a/python/tvm/autotvm/tuner/tuner.py b/python/tvm/autotvm/tuner/tuner.py index b769d345bc9b..ba54291ada67 100644 --- a/python/tvm/autotvm/tuner/tuner.py +++ b/python/tvm/autotvm/tuner/tuner.py @@ -22,7 +22,7 @@ import numpy as np from ..measure import MeasureInput, create_measure_batch -from ..util import format_si_prefix +from ..utils import format_si_prefix from ..env import GLOBAL_SCOPE @@ -107,7 +107,7 @@ def tune(self, n_trial, measure_option, early_stopping=None, callbacks=(), si_pr with no return value. These callback functions will be called on every measurement pair. See autotvm/tuner/callback.py for some examples. si_prefix: str - One of tvm.autotvm.util.SI_PREFIXES. The SI prefix to use when reporting FLOPS. + One of tvm.autotvm.utils.SI_PREFIXES. The SI prefix to use when reporting FLOPS. """ measure_batch = create_measure_batch(self.task, measure_option) n_parallel = getattr(measure_batch, "n_parallel", 1) diff --git a/python/tvm/autotvm/tuner/xgboost_cost_model.py b/python/tvm/autotvm/tuner/xgboost_cost_model.py index f66764c42520..14bc683c10b1 100644 --- a/python/tvm/autotvm/tuner/xgboost_cost_model.py +++ b/python/tvm/autotvm/tuner/xgboost_cost_model.py @@ -29,7 +29,7 @@ xgb = None from .. import feature -from ..util import get_rank +from ..utils import get_rank from .metric import max_curve, recall_curve, cover_curve from .model_based_tuner import CostModel, FeatureCache diff --git a/python/tvm/autotvm/util.py b/python/tvm/autotvm/utils.py similarity index 100% rename from python/tvm/autotvm/util.py rename to python/tvm/autotvm/utils.py diff --git a/python/tvm/contrib/binutil.py b/python/tvm/contrib/binutils.py similarity index 98% rename from python/tvm/contrib/binutil.py rename to python/tvm/contrib/binutils.py index b0f36c8277ed..646362a5587f 100644 --- a/python/tvm/contrib/binutil.py +++ b/python/tvm/contrib/binutils.py @@ -19,7 +19,7 @@ import os import subprocess import tvm._ffi -from . import util +from . import utils # TODO does this file still belong in `contrib`. is it too µTVM-specific? @@ -217,7 +217,7 @@ def tvm_callback_relocate_binary( stack_pointer_init=stack_pointer_init, ) - tmp_dir = util.tempdir() + tmp_dir = utils.tempdir() rel_obj_path = tmp_dir.relpath("relocated.obj") rel_ld_script_path = tmp_dir.relpath("relocate.lds") with open(rel_ld_script_path, "w") as f: @@ -265,7 +265,7 @@ def tvm_callback_read_binary_section(binary, section, toolchain_prefix): section_bin : bytearray contents of the read section """ - tmp_dir = util.tempdir() + tmp_dir = utils.tempdir() tmp_bin = tmp_dir.relpath("temp.bin") tmp_section = tmp_dir.relpath("tmp_section.bin") with open(tmp_bin, "wb") as out_file: @@ -306,7 +306,7 @@ def tvm_callback_get_symbol_map(binary, toolchain_prefix): map of defined symbols to addresses, encoded as a series of alternating newline-separated keys and values """ - tmp_dir = util.tempdir() + tmp_dir = utils.tempdir() tmp_obj = tmp_dir.relpath("tmp_obj.bin") with open(tmp_obj, "wb") as out_file: out_file.write(bytes(binary)) diff --git a/python/tvm/contrib/clang.py b/python/tvm/contrib/clang.py index edc12004dc4d..989444730412 100644 --- a/python/tvm/contrib/clang.py +++ b/python/tvm/contrib/clang.py @@ -20,7 +20,7 @@ from tvm._ffi.base import py_str import tvm.target -from . import util +from . import utils def find_clang(required=True): @@ -49,7 +49,7 @@ def find_clang(required=True): cc_list += ["clang-%d" % major] cc_list += ["clang"] cc_list += ["clang.exe"] - valid_list = [util.which(x) for x in cc_list] + valid_list = [utils.which(x) for x in cc_list] valid_list = [x for x in valid_list if x] if not valid_list and required: raise RuntimeError("cannot find clang, candidates are: " + str(cc_list)) @@ -83,12 +83,12 @@ def create_llvm(inputs, output=None, options=None, cc=None): cc = cc if cc else find_clang()[0] cmd = [cc] cmd += ["-S", "-emit-llvm"] - temp = util.tempdir() + temp = utils.tempdir() output = output if output else temp.relpath("output.ll") inputs = [inputs] if isinstance(inputs, str) else inputs input_files = [] for i, code in enumerate(inputs): - if util.is_source_path(code): + if utils.is_source_path(code): input_files.append(code) else: temp_path = temp.relpath("input%d.cc" % i) diff --git a/python/tvm/contrib/nvcc.py b/python/tvm/contrib/nvcc.py index f958c1f8a0cf..53a507f2d79a 100644 --- a/python/tvm/contrib/nvcc.py +++ b/python/tvm/contrib/nvcc.py @@ -25,7 +25,7 @@ import tvm._ffi from tvm.runtime import ndarray as nd -from . import util +from . import utils from .._ffi.base import py_str @@ -54,7 +54,7 @@ def compile_cuda(code, target="ptx", arch=None, options=None, path_target=None): cubin : bytearray The bytearray of the cubin """ - temp = util.tempdir() + temp = utils.tempdir() if target not in ["cubin", "ptx", "fatbin"]: raise ValueError("target must be in cubin, ptx, fatbin") temp_code = temp.relpath("my_kernel.cu") diff --git a/python/tvm/contrib/peak.py b/python/tvm/contrib/peak.py index d9dd5360da85..62ee9fea400b 100644 --- a/python/tvm/contrib/peak.py +++ b/python/tvm/contrib/peak.py @@ -20,13 +20,13 @@ import logging import tvm from tvm import te -from . import util +from . import utils from .. import rpc def _convert_to_remote(func, remote): """ convert module function to remote rpc function""" - temp = util.tempdir() + temp = utils.tempdir() path_dso = temp.relpath("tmp_func.tar") func.export_library(path_dso) diff --git a/python/tvm/contrib/rocm.py b/python/tvm/contrib/rocm.py index 7b222f3bb20e..e69b2558c0b5 100644 --- a/python/tvm/contrib/rocm.py +++ b/python/tvm/contrib/rocm.py @@ -23,7 +23,7 @@ import tvm.runtime import tvm.target -from . import util +from . import utils def find_lld(required=True): @@ -51,7 +51,7 @@ def find_lld(required=True): lld_list += ["ld.lld-%d.0" % major] lld_list += ["ld.lld-%d" % major] lld_list += ["ld.lld"] - valid_list = [util.which(x) for x in lld_list] + valid_list = [utils.which(x) for x in lld_list] valid_list = [x for x in valid_list if x] if not valid_list and required: raise RuntimeError("cannot find ld.lld, candidates are: " + str(lld_list)) @@ -97,7 +97,7 @@ def callback_rocm_link(obj_bin): cobj_bin : bytearray The HSA Code Object """ - tmp_dir = util.tempdir() + tmp_dir = utils.tempdir() tmp_obj = tmp_dir.relpath("rocm_kernel.o") tmp_cobj = tmp_dir.relpath("rocm_kernel.co") with open(tmp_obj, "wb") as out_file: diff --git a/python/tvm/contrib/sdaccel.py b/python/tvm/contrib/sdaccel.py index b88fa4c840a2..930752c2bc6b 100644 --- a/python/tvm/contrib/sdaccel.py +++ b/python/tvm/contrib/sdaccel.py @@ -19,7 +19,7 @@ import os import tvm._ffi -from . import util +from . import utils @tvm._ffi.register_func("tvm_callback_sdaccel_compile") @@ -40,7 +40,7 @@ def compile_vhls(kernel_info, device_name): xclbin : bytearray The bytearray of the xclbin """ - tmp_dir = util.tempdir() + tmp_dir = utils.tempdir() sdk = os.environ.get("XILINX_SDX", None) xocc = os.path.join(sdk, "bin/xocc") if sdk else "xocc" diff --git a/python/tvm/contrib/spirv.py b/python/tvm/contrib/spirv.py index a5d847158c63..94b24d0c7b09 100644 --- a/python/tvm/contrib/spirv.py +++ b/python/tvm/contrib/spirv.py @@ -17,7 +17,7 @@ """Utility for Interacting with SPIRV Tools""" import subprocess import os -from . import util +from . import utils from .._ffi.base import py_str @@ -37,7 +37,7 @@ def optimize(spv_bin): The HSA Code Object """ - tmp_dir = util.tempdir() + tmp_dir = utils.tempdir() tmp_in = tmp_dir.relpath("input.spv") tmp_out = tmp_dir.relpath("output.spv") with open(tmp_in, "wb") as out_file: diff --git a/python/tvm/contrib/tar.py b/python/tvm/contrib/tar.py index bcc34a18637c..354887730f46 100644 --- a/python/tvm/contrib/tar.py +++ b/python/tvm/contrib/tar.py @@ -21,7 +21,7 @@ import os import shutil import subprocess -from . import util +from . import utils from .._ffi.base import py_str @@ -38,7 +38,7 @@ def tar(output, files): """ cmd = ["tar"] cmd += ["-czf"] - temp = util.tempdir() + temp = utils.tempdir() fset = set() for fname in files: base = os.path.basename(fname) diff --git a/python/tvm/contrib/util.py b/python/tvm/contrib/utils.py similarity index 100% rename from python/tvm/contrib/util.py rename to python/tvm/contrib/utils.py diff --git a/python/tvm/contrib/xcode.py b/python/tvm/contrib/xcode.py index 13bd74762163..0c0dac1234e8 100644 --- a/python/tvm/contrib/xcode.py +++ b/python/tvm/contrib/xcode.py @@ -23,7 +23,7 @@ import subprocess import json from .._ffi.base import py_str -from . import util +from . import utils def xcrun(cmd): @@ -132,7 +132,7 @@ def compile_metal(code, path_target=None, sdk="macosx"): metallib : bytearray The bytearray of the metallib """ - temp = util.tempdir() + temp = utils.tempdir() temp_code = temp.relpath("my_lib.metal") temp_ir = temp.relpath("my_lib.air") temp_target = temp.relpath("my_lib.metallib") @@ -248,7 +248,7 @@ def popen_test_rpc(host, port, key, destination, libs=None, options=None): ) # Lock the path so only one file can run - lock = util.filelock(os.path.join(rpc_root, "ios_rpc.lock")) + lock = utils.filelock(os.path.join(rpc_root, "ios_rpc.lock")) with open(os.path.join(rpc_root, "rpc_config.txt"), "w") as fo: fo.write("%s %d %s\n" % (host, port, key)) diff --git a/python/tvm/driver/tvmc/compiler.py b/python/tvm/driver/tvmc/compiler.py index 8001ee29f757..eeb5d07fe051 100644 --- a/python/tvm/driver/tvmc/compiler.py +++ b/python/tvm/driver/tvmc/compiler.py @@ -26,7 +26,7 @@ from tvm import autotvm from tvm import relay from tvm.contrib import cc -from tvm.contrib import util +from tvm.contrib import utils from . import common, frontends from .main import register_parser @@ -238,7 +238,7 @@ def save_module(module_path, graph, lib, params, cross=None): lib_name = "mod.so" graph_name = "mod.json" param_name = "mod.params" - temp = util.tempdir() + temp = utils.tempdir() path_lib = temp.relpath(lib_name) if not cross: logger.debug("exporting library to %s", path_lib) diff --git a/python/tvm/error.py b/python/tvm/error.py index d7628a735145..819f06475e0a 100644 --- a/python/tvm/error.py +++ b/python/tvm/error.py @@ -50,7 +50,7 @@ def __init__(self, msg): if "TVM hint:" not in msg: msg += ( "\nTVM hint: You hit an internal error. " - + "Please open a thread on https://discuss.tvm.ai/ to report it." + + "Please open a thread on https://discuss.tvm.apache.org/ to report it." ) super(InternalError, self).__init__(msg) diff --git a/python/tvm/micro/build.py b/python/tvm/micro/build.py index 908bc9637dcf..d1a3c4163755 100644 --- a/python/tvm/micro/build.py +++ b/python/tvm/micro/build.py @@ -21,7 +21,7 @@ import logging import os import re -from tvm.contrib import util +from tvm.contrib import utils _LOG = logging.getLogger(__name__) @@ -32,11 +32,11 @@ class Workspace: def __init__(self, root=None, debug=False): if debug or root is not None: - with util.TempDirectory.set_keep_for_debug(): - self.tempdir = util.tempdir(custom_path=root) + with utils.TempDirectory.set_keep_for_debug(): + self.tempdir = utils.tempdir(custom_path=root) _LOG.info("Created debug mode workspace at: %s", self.tempdir.temp_dir) else: - self.tempdir = util.tempdir() + self.tempdir = utils.tempdir() def relpath(self, path): return self.tempdir.relpath(path) diff --git a/python/tvm/micro/compiler.py b/python/tvm/micro/compiler.py index 307c9809fc21..069f600a823e 100644 --- a/python/tvm/micro/compiler.py +++ b/python/tvm/micro/compiler.py @@ -22,7 +22,7 @@ import os import re -from tvm.contrib import binutil +from tvm.contrib import binutils import tvm.target from . import build from . import class_factory @@ -232,13 +232,13 @@ def library(self, output, sources, options=None): output_filename = f"{src_base}.o" output_abspath = os.path.join(output, output_filename) - binutil.run_cmd(args + ["-c", "-o", output_abspath, src]) + binutils.run_cmd(args + ["-c", "-o", output_abspath, src]) outputs.append(output_abspath) output_filename = f"{os.path.basename(output)}.a" output_abspath = os.path.join(output, output_filename) - binutil.run_cmd([prefix + "ar", "-r", output_abspath] + outputs) - binutil.run_cmd([prefix + "ranlib", output_abspath]) + binutils.run_cmd([prefix + "ar", "-r", output_abspath] + outputs) + binutils.run_cmd([prefix + "ranlib", output_abspath]) return tvm.micro.MicroLibrary(output, [output_filename]) @@ -273,7 +273,7 @@ def binary(self, output, objects, options=None, link_main=True, main_options=Non for lib_name in obj.library_files: args.append(obj.abspath(lib_name)) - binutil.run_cmd(args) + binutils.run_cmd(args) return tvm.micro.MicroBinary(output, output_filename, []) @property diff --git a/python/tvm/micro/micro_library.py b/python/tvm/micro/micro_library.py index b2876509708e..74687ede1235 100644 --- a/python/tvm/micro/micro_library.py +++ b/python/tvm/micro/micro_library.py @@ -17,7 +17,7 @@ """Defines an Artifact subclass that describes a compiled static library.""" -from tvm.contrib import util +from tvm.contrib import utils from . import artifact from . import compiler @@ -79,7 +79,7 @@ def create_micro_library(output, objects, options=None): options : Optional[List[str]] If given, additional command-line flags for the compiler. """ - temp_dir = util.tempdir() + temp_dir = utils.tempdir() comp = compiler.DefaultCompiler() output = temp_dir.relpath("micro-library.o") comp.library(output, objects, options=options) diff --git a/python/tvm/relay/backend/vm.py b/python/tvm/relay/backend/vm.py index b0a5e9899b02..0f7875a9202e 100644 --- a/python/tvm/relay/backend/vm.py +++ b/python/tvm/relay/backend/vm.py @@ -223,7 +223,7 @@ def _tophub_context(self, target): if isinstance(autotvm.DispatchContext.current, autotvm.FallbackContext): tophub_context = autotvm.tophub.context(list(target.values())) else: - tophub_context = autotvm.util.EmptyContext() + tophub_context = autotvm.utils.EmptyContext() return tophub_context diff --git a/python/tvm/relay/build_module.py b/python/tvm/relay/build_module.py index bd0c3e5f4d73..35bd8e6d3d4d 100644 --- a/python/tvm/relay/build_module.py +++ b/python/tvm/relay/build_module.py @@ -253,7 +253,7 @@ def build(mod, target=None, target_host=None, params=None, mod_name="default"): if isinstance(autotvm.DispatchContext.current, autotvm.FallbackContext): tophub_context = autotvm.tophub.context(list(target.values())) else: - tophub_context = autotvm.util.EmptyContext() + tophub_context = autotvm.utils.EmptyContext() with tophub_context: bld_mod = BuildModule() @@ -307,7 +307,7 @@ def optimize(mod, target=None, params=None): if isinstance(autotvm.DispatchContext.current, autotvm.FallbackContext): tophub_context = autotvm.tophub.context(list(target.values())) else: - tophub_context = autotvm.util.EmptyContext() + tophub_context = autotvm.utils.EmptyContext() with tophub_context: bld_mod = BuildModule() diff --git a/python/tvm/relay/frontend/common.py b/python/tvm/relay/frontend/common.py index b27c759b8d03..ae51f2155402 100644 --- a/python/tvm/relay/frontend/common.py +++ b/python/tvm/relay/frontend/common.py @@ -22,7 +22,7 @@ import tvm from tvm.ir import IRModule -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple from .. import expr as _expr from .. import function as _function diff --git a/python/tvm/relay/frontend/mxnet.py b/python/tvm/relay/frontend/mxnet.py index a543f78bd949..2242be1bcdeb 100644 --- a/python/tvm/relay/frontend/mxnet.py +++ b/python/tvm/relay/frontend/mxnet.py @@ -23,7 +23,7 @@ from tvm.ir import IRModule from tvm import relay -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple from .. import analysis from .. import expr as _expr from .. import function as _function diff --git a/python/tvm/relay/frontend/onnx.py b/python/tvm/relay/frontend/onnx.py index ccf644e82c57..fa404efc39cf 100644 --- a/python/tvm/relay/frontend/onnx.py +++ b/python/tvm/relay/frontend/onnx.py @@ -21,7 +21,7 @@ import numpy as np import tvm from tvm.ir import IRModule -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple from ... import nd as _nd from .. import analysis @@ -2649,7 +2649,7 @@ def from_onnx(model, shape=None, dtype="float32", opset=None, freeze_params=Fals retains that dynamism upon import, and the compiler attempts to convert the model into a static shapes at compile time. If this fails, there may still be dynamic operations in the model. Not all TVM kernels currently support - dynamic shapes, please file an issue on discuss.tvm.ai + dynamic shapes, please file an issue on discuss.tvm.apache.org if you hit an error with dynamic kernels. Parameters diff --git a/python/tvm/relay/frontend/pytorch.py b/python/tvm/relay/frontend/pytorch.py index 8d164314ecc8..d8c0769e24ea 100644 --- a/python/tvm/relay/frontend/pytorch.py +++ b/python/tvm/relay/frontend/pytorch.py @@ -25,7 +25,7 @@ import numpy as np import tvm -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple from .. import analysis as _analysis from .. import expr as _expr diff --git a/python/tvm/relay/frontend/tensorflow.py b/python/tvm/relay/frontend/tensorflow.py index 89b36256152e..218c6e57f995 100644 --- a/python/tvm/relay/frontend/tensorflow.py +++ b/python/tvm/relay/frontend/tensorflow.py @@ -27,7 +27,7 @@ from tvm.ir import IRModule from tvm.relay.prelude import Prelude, StaticTensorArrayOps, get_tensor_array_shape from tvm.relay.transform import InferType -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple from .. import analysis from .. import expr as _expr diff --git a/python/tvm/relay/frontend/tensorflow_parser.py b/python/tvm/relay/frontend/tensorflow_parser.py index 3c1d342ac248..b1b10eb81f56 100644 --- a/python/tvm/relay/frontend/tensorflow_parser.py +++ b/python/tvm/relay/frontend/tensorflow_parser.py @@ -18,7 +18,7 @@ # pylint: disable=import-outside-toplevel, assignment-from-no-return import os -from tvm.contrib import util +from tvm.contrib import utils class TFParser(object): @@ -45,7 +45,7 @@ class TFParser(object): def __init__(self, model_dir, outputs=None): from tensorflow.core.framework import graph_pb2 - self._tmp_dir = util.tempdir() + self._tmp_dir = utils.tempdir() self._model_dir = model_dir self._graph = graph_pb2.GraphDef() self._outputs = outputs or [] diff --git a/python/tvm/relay/op/_reduce.py b/python/tvm/relay/op/_reduce.py index 604098f30ad9..2872640109d3 100644 --- a/python/tvm/relay/op/_reduce.py +++ b/python/tvm/relay/op/_reduce.py @@ -19,7 +19,7 @@ from tvm.runtime import convert from tvm.te.hybrid import script -from tvm.topi.util import get_const_int, get_const_tuple +from tvm.topi.utils import get_const_int, get_const_tuple from . import op as _reg _reg.register_reduce_schedule("argmax") diff --git a/python/tvm/relay/op/_tensor_grad.py b/python/tvm/relay/op/_tensor_grad.py index 9f4f20c9000c..b070d9f5b3ff 100644 --- a/python/tvm/relay/op/_tensor_grad.py +++ b/python/tvm/relay/op/_tensor_grad.py @@ -16,12 +16,11 @@ # under the License. # pylint: disable=invalid-name, unused-argument """Backend compiler related feature registration""" -from __future__ import absolute_import - -from tvm.topi.nn.util import get_pad_tuple -from tvm.topi.util import get_const_tuple +from tvm.topi.nn.utils import get_pad_tuple +from tvm.topi.utils import get_const_tuple from tvm.error import OpError + from ..expr import Tuple, TupleGetItem, const, Var from ..ty import TensorType from ..loops import while_loop diff --git a/python/tvm/relay/op/_transform.py b/python/tvm/relay/op/_transform.py index 156c5b7dad6c..edcd5b9ce161 100644 --- a/python/tvm/relay/op/_transform.py +++ b/python/tvm/relay/op/_transform.py @@ -22,7 +22,7 @@ from tvm.te.hybrid import script from tvm.runtime import convert from tvm import topi -from tvm.topi.util import get_const_int, get_const_tuple +from tvm.topi.utils import get_const_int, get_const_tuple from . import op as _reg from . import strategy from .op import OpPattern diff --git a/python/tvm/relay/op/dyn/image/_image.py b/python/tvm/relay/op/dyn/image/_image.py index cc0099836e2e..e3415795712e 100644 --- a/python/tvm/relay/op/dyn/image/_image.py +++ b/python/tvm/relay/op/dyn/image/_image.py @@ -21,7 +21,7 @@ import tvm.topi from tvm.runtime import convert from tvm.te.hybrid import script -from tvm.topi.util import nchw_pack_layout, nchw_xc_layout +from tvm.topi.utils import nchw_pack_layout, nchw_xc_layout from ... import op as reg diff --git a/python/tvm/relay/op/image/_image.py b/python/tvm/relay/op/image/_image.py index adbed84713fe..c0cdf64c621a 100644 --- a/python/tvm/relay/op/image/_image.py +++ b/python/tvm/relay/op/image/_image.py @@ -22,7 +22,7 @@ from tvm.runtime import convert from tvm import topi -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple from .. import op as reg from .. import strategy from ..op import OpPattern diff --git a/python/tvm/relay/op/nn/_nn.py b/python/tvm/relay/op/nn/_nn.py index c9926647989e..c235f87d1e99 100644 --- a/python/tvm/relay/op/nn/_nn.py +++ b/python/tvm/relay/op/nn/_nn.py @@ -19,7 +19,7 @@ from __future__ import absolute_import from tvm import topi -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple from tvm.runtime import convert from tvm.te.hybrid import script diff --git a/python/tvm/relay/op/nn/nn.py b/python/tvm/relay/op/nn/nn.py index 1aad4e7125fd..0d012540343f 100644 --- a/python/tvm/relay/op/nn/nn.py +++ b/python/tvm/relay/op/nn/nn.py @@ -20,7 +20,7 @@ from . import _make from ..dyn.nn import _make as _dyn_make -from .util import get_pad_tuple1d, get_pad_tuple2d, get_pad_tuple3d +from .utils import get_pad_tuple1d, get_pad_tuple2d, get_pad_tuple3d from ...expr import const, Expr diff --git a/python/tvm/relay/op/nn/util.py b/python/tvm/relay/op/nn/utils.py similarity index 100% rename from python/tvm/relay/op/nn/util.py rename to python/tvm/relay/op/nn/utils.py diff --git a/python/tvm/relay/op/strategy/arm_cpu.py b/python/tvm/relay/op/strategy/arm_cpu.py index 6759a54d0b80..985124e305ee 100644 --- a/python/tvm/relay/op/strategy/arm_cpu.py +++ b/python/tvm/relay/op/strategy/arm_cpu.py @@ -180,7 +180,7 @@ def conv2d_strategy_arm_cpu(attrs, inputs, out_type, target): # This schedule has incorrect result on some hardware platforms (like NV Jetson TX2) # Let us comment it out but not remove. # see discussion: - # https://discuss.tvm.ai/t/autotuner-incorrect-result-after-tuning-mobilenetv2-on-arm-cpu/6088 + # https://discuss.tvm.apache.org/t/autotuner-incorrect-result-after-tuning-mobilenetv2-on-arm-cpu/6088 # strategy.add_implementation( # wrap_compute_conv2d(topi.arm_cpu.depthwise_conv2d_nchw_spatial_pack), # wrap_topi_schedule(topi.arm_cpu.schedule_depthwise_conv2d_nchw_spatial_pack), diff --git a/python/tvm/relay/op/strategy/generic.py b/python/tvm/relay/op/strategy/generic.py index 8933c38549b8..f1d101959b2e 100644 --- a/python/tvm/relay/op/strategy/generic.py +++ b/python/tvm/relay/op/strategy/generic.py @@ -20,7 +20,7 @@ import re from tvm import topi -from tvm.topi.util import get_const_int, get_const_float, get_const_tuple, get_float_tuple +from tvm.topi.utils import get_const_int, get_const_float, get_const_tuple, get_float_tuple from .. import op as _op from ....target import generic_func, override_native_generic_func diff --git a/python/tvm/relay/op/vision/_rcnn.py b/python/tvm/relay/op/vision/_rcnn.py index a5cc266f1566..46eb3cbc2e53 100644 --- a/python/tvm/relay/op/vision/_rcnn.py +++ b/python/tvm/relay/op/vision/_rcnn.py @@ -17,7 +17,7 @@ # pylint: disable=invalid-name, unused-argument """Faster R-CNN and Mask R-CNN operations.""" from tvm import topi -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple from .. import op as reg from .. import strategy from ..op import OpPattern diff --git a/python/tvm/relay/qnn/op/qnn.py b/python/tvm/relay/qnn/op/qnn.py index e4a6cbf43383..3f23d6895b43 100644 --- a/python/tvm/relay/qnn/op/qnn.py +++ b/python/tvm/relay/qnn/op/qnn.py @@ -19,7 +19,7 @@ from __future__ import absolute_import as _abs from tvm.relay.expr import Tuple, TupleWrapper -from tvm.relay.op.nn.util import get_pad_tuple2d +from tvm.relay.op.nn.utils import get_pad_tuple2d from . import _make diff --git a/python/tvm/relay/transform/transform.py b/python/tvm/relay/transform/transform.py index 060547e4c4d7..f0f55f60d0e3 100644 --- a/python/tvm/relay/transform/transform.py +++ b/python/tvm/relay/transform/transform.py @@ -422,7 +422,7 @@ def ConvertLayout(desired_layouts): parser and relay.build call. This is very helpful for hardware backends that support/prefer only type of data layout. - RFC - https://discuss.tvm.ai/t/layout-conversion-pass/4009 + RFC - https://discuss.tvm.apache.org/t/layout-conversion-pass/4009 This pass uses most of the AlterOpLayout and InferCorrectLayout infrastructure. We can define new layouts for conv2d ops for now. Most of the other operators try to adapt to their input diff --git a/python/tvm/rpc/client.py b/python/tvm/rpc/client.py index b9ad94d87327..a50f3b856800 100644 --- a/python/tvm/rpc/client.py +++ b/python/tvm/rpc/client.py @@ -22,7 +22,7 @@ import time import tvm._ffi -from tvm.contrib import util +from tvm.contrib import utils from tvm._ffi.base import TVMError from tvm.runtime import ndarray as nd @@ -244,7 +244,7 @@ def __init__(self): @tvm._ffi.register_func("rpc.PopenSession") def _popen_session(binary): - temp = util.tempdir() + temp = utils.tempdir() if isinstance(binary, (bytes, bytearray)): path_exec = temp.relpath("server.minrpc") diff --git a/python/tvm/rpc/server.py b/python/tvm/rpc/server.py index 728723432aa8..9489a734eb8b 100644 --- a/python/tvm/rpc/server.py +++ b/python/tvm/rpc/server.py @@ -42,7 +42,7 @@ from tvm._ffi.base import py_str from tvm._ffi.libinfo import find_lib_path from tvm.runtime.module import load_module as _load_module -from tvm.contrib import util +from tvm.contrib import utils from . import _ffi_api from . import base from .base import TrackerCode @@ -55,7 +55,7 @@ def _server_env(load_library, work_path=None): if work_path: temp = work_path else: - temp = util.tempdir() + temp = utils.tempdir() # pylint: disable=unused-variable @tvm._ffi.register_func("tvm.rpc.server.workpath", override=True) @@ -89,7 +89,7 @@ def download_linked_module(file_name): # Extra dependencies during runtime. from tvm.contrib import cc as _cc, tar as _tar - tar_temp = util.tempdir(custom_path=path.replace(".tar", "")) + tar_temp = utils.tempdir(custom_path=path.replace(".tar", "")) _tar.untar(path, tar_temp.temp_dir) files = [tar_temp.relpath(x) for x in tar_temp.listdir()] _cc.create_shared(path + ".so", files, cc=cc) @@ -230,7 +230,7 @@ def _accept_conn(listen_sock, tracker_conn, ping_period=2): raise exc # step 3: serving - work_path = util.tempdir() + work_path = utils.tempdir() logger.info("connection from %s", addr) server_proc = multiprocessing.Process( target=_serve_loop, args=(conn, addr, load_library, work_path) diff --git a/python/tvm/runtime/module.py b/python/tvm/runtime/module.py index 0559a016a9c2..cef617399bff 100644 --- a/python/tvm/runtime/module.py +++ b/python/tvm/runtime/module.py @@ -277,7 +277,7 @@ def export_library(self, file_name, fcompile=None, addons=None, **kwargs): raise RuntimeError("Cannot call export_library in runtime only mode") # Extra dependencies during runtime. from pathlib import Path - from tvm.contrib import cc as _cc, tar as _tar, util as _util + from tvm.contrib import cc as _cc, tar as _tar, utils as _utils if isinstance(file_name, Path): file_name = str(file_name) @@ -292,7 +292,7 @@ def export_library(self, file_name, fcompile=None, addons=None, **kwargs): return modules = self._collect_dso_modules() - temp = _util.tempdir() + temp = _utils.tempdir() files = addons if addons else [] is_system_lib = False has_c_module = False @@ -408,9 +408,9 @@ def load_module(path, fmt=""): path += ".so" elif path.endswith(".tar"): # Extra dependencies during runtime. - from tvm.contrib import cc as _cc, util as _util, tar as _tar + from tvm.contrib import cc as _cc, utils as _utils, tar as _tar - tar_temp = _util.tempdir(custom_path=path.replace(".tar", "")) + tar_temp = _utils.tempdir(custom_path=path.replace(".tar", "")) _tar.untar(path, tar_temp.temp_dir) files = [tar_temp.relpath(x) for x in tar_temp.listdir()] _cc.create_shared(path + ".so", files, cc=cc) diff --git a/python/tvm/runtime/vm.py b/python/tvm/runtime/vm.py index 81a909b2e1c0..448cb137cc9b 100644 --- a/python/tvm/runtime/vm.py +++ b/python/tvm/runtime/vm.py @@ -120,7 +120,7 @@ def save(self): executable = relay.vm.compile(mod, target) code, lib = executable.save() # save and load the code and lib file. - tmp = tvm.contrib.util.tempdir() + tmp = tvm.contrib.utils.tempdir() path_lib = tmp.relpath("lib.so") lib.export_library(path_lib) with open(tmp.relpath("code.ro"), "wb") as fo: diff --git a/python/tvm/te/hybrid/module.py b/python/tvm/te/hybrid/module.py index 2af67853ca5b..beea8844f78c 100644 --- a/python/tvm/te/hybrid/module.py +++ b/python/tvm/te/hybrid/module.py @@ -23,7 +23,7 @@ import ast -from tvm.contrib import util +from tvm.contrib import utils from .utils import _internal_assert from .utils import _is_tvm_arg_types from .parser import source_to_op @@ -48,7 +48,7 @@ def __init__(self, src=None, name=None): """ self.src_ = self.name = self.func_ = self.root_ = None if src is not None: - temp = util.tempdir() + temp = utils.tempdir() dst = temp.relpath("script.py") with open(dst, "w") as f: f.write("import tvm\n@tvm.te.hybrid.script\n%s" % src) diff --git a/python/tvm/topi/__init__.py b/python/tvm/topi/__init__.py index 2d445454e8b1..97951d941f64 100644 --- a/python/tvm/topi/__init__.py +++ b/python/tvm/topi/__init__.py @@ -48,7 +48,7 @@ from . import mali from . import bifrost from . import intel_graphics -from . import util +from . import utils from . import rocm from . import vision from . import image @@ -56,7 +56,7 @@ from . import hls # error reporting -from .util import InvalidShapeError +from .utils import InvalidShapeError # not import testing by default # because testing can have extra deps that are not necessary diff --git a/python/tvm/topi/arm_cpu/bitserial_conv2d.py b/python/tvm/topi/arm_cpu/bitserial_conv2d.py index fb22930b5681..88940a000397 100644 --- a/python/tvm/topi/arm_cpu/bitserial_conv2d.py +++ b/python/tvm/topi/arm_cpu/bitserial_conv2d.py @@ -25,8 +25,8 @@ from ..nn.pad import pad from ..nn.bitserial_conv2d import bitserial_conv2d_legalize from ..nn.bitserial_util import bitpack, binary_op_multiplier -from ..nn.util import get_pad_tuple -from ..util import get_const_int, get_const_tuple +from ..nn.utils import get_pad_tuple +from ..utils import get_const_int, get_const_tuple def _kernel_vec_spatial_pack_nhwc(kernel, kernel_bits, VC, use_bitpack=True): diff --git a/python/tvm/topi/arm_cpu/bitserial_dense.py b/python/tvm/topi/arm_cpu/bitserial_dense.py index 61778b7eb544..8ceab5153889 100644 --- a/python/tvm/topi/arm_cpu/bitserial_dense.py +++ b/python/tvm/topi/arm_cpu/bitserial_dense.py @@ -20,7 +20,7 @@ import tvm from tvm import te from tvm import autotvm -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple from .. import tag from .bitserial_conv2d import _intrin_popcount from ..nn.pad import pad diff --git a/python/tvm/topi/arm_cpu/conv2d.py b/python/tvm/topi/arm_cpu/conv2d.py index b7f94f7e390c..7dbbf9d3d447 100644 --- a/python/tvm/topi/arm_cpu/conv2d.py +++ b/python/tvm/topi/arm_cpu/conv2d.py @@ -23,9 +23,9 @@ from tvm import autotvm import tvm.contrib.nnpack -from ..util import traverse_inline, get_const_tuple +from ..utils import traverse_inline, get_const_tuple from .. import nn -from ..nn.util import get_const_int, get_pad_tuple +from ..nn.utils import get_const_int, get_pad_tuple from ..nn.winograd_util import winograd_transform_matrices from .conv2d_spatial_pack import ( conv2d_spatial_pack_nchw, diff --git a/python/tvm/topi/arm_cpu/conv2d_alter_op.py b/python/tvm/topi/arm_cpu/conv2d_alter_op.py index a64bc413e0c6..c7c572c81110 100644 --- a/python/tvm/topi/arm_cpu/conv2d_alter_op.py +++ b/python/tvm/topi/arm_cpu/conv2d_alter_op.py @@ -25,7 +25,7 @@ from tvm import autotvm from ..nn import conv2d_alter_layout -from ..util import get_const_tuple +from ..utils import get_const_tuple from ..x86.conv2d import _get_default_config as _get_x86_default_config from .arm_utils import get_tiling_B_interleaved_t diff --git a/python/tvm/topi/arm_cpu/conv2d_gemm.py b/python/tvm/topi/arm_cpu/conv2d_gemm.py index b40fb89b5d33..81326f169260 100644 --- a/python/tvm/topi/arm_cpu/conv2d_gemm.py +++ b/python/tvm/topi/arm_cpu/conv2d_gemm.py @@ -21,8 +21,8 @@ from tvm import te from tvm.topi import nn from tvm.autotvm.task.space import AnnotateEntity, ReorderEntity, OtherOptionEntity -from ..util import get_const_tuple, get_const_int -from ..nn.util import get_pad_tuple +from ..utils import get_const_tuple, get_const_int +from ..nn.utils import get_pad_tuple from .tensor_intrin import ( gemm_quantized, gemm_quantized_impl, diff --git a/python/tvm/topi/arm_cpu/conv2d_int8.py b/python/tvm/topi/arm_cpu/conv2d_int8.py index 43fe80178bd3..445b9ec0c113 100644 --- a/python/tvm/topi/arm_cpu/conv2d_int8.py +++ b/python/tvm/topi/arm_cpu/conv2d_int8.py @@ -19,7 +19,7 @@ from tvm import te from tvm import autotvm from .. import tag -from ..util import traverse_inline, get_const_tuple +from ..utils import traverse_inline, get_const_tuple from ..generic import conv2d as conv2d_generic from .. import nn from ..nn.conv2d import _get_workload as _get_conv2d_workload diff --git a/python/tvm/topi/arm_cpu/conv2d_spatial_pack.py b/python/tvm/topi/arm_cpu/conv2d_spatial_pack.py index 2e664433c15b..f4cd9d899b73 100644 --- a/python/tvm/topi/arm_cpu/conv2d_spatial_pack.py +++ b/python/tvm/topi/arm_cpu/conv2d_spatial_pack.py @@ -21,8 +21,8 @@ from tvm import te from tvm import autotvm from .. import nn -from ..util import get_const_tuple -from ..nn.util import get_const_int, get_pad_tuple +from ..utils import get_const_tuple +from ..nn.utils import get_const_int, get_pad_tuple def conv2d_spatial_pack_nchw(cfg, data, kernel, strides, padding, dilation, out_dtype, num_tile): diff --git a/python/tvm/topi/arm_cpu/conv2d_transpose.py b/python/tvm/topi/arm_cpu/conv2d_transpose.py index bab32ab9def6..c9f1e1efddfc 100644 --- a/python/tvm/topi/arm_cpu/conv2d_transpose.py +++ b/python/tvm/topi/arm_cpu/conv2d_transpose.py @@ -23,7 +23,7 @@ from tvm import autotvm from ..nn import dilate, pad, get_pad_tuple -from ..util import get_const_tuple, traverse_inline +from ..utils import get_const_tuple, traverse_inline from .conv2d_spatial_pack import schedule_conv2d_spatial_pack_nchw diff --git a/python/tvm/topi/arm_cpu/cortex_m7/conv2d/direct.py b/python/tvm/topi/arm_cpu/cortex_m7/conv2d/direct.py index b084066fc152..4f721da5420c 100644 --- a/python/tvm/topi/arm_cpu/cortex_m7/conv2d/direct.py +++ b/python/tvm/topi/arm_cpu/cortex_m7/conv2d/direct.py @@ -21,7 +21,7 @@ from tvm import autotvm from tvm.autotvm.task import deserialize_args from tvm.topi.nn.conv2d import conv2d_nchw, conv2d_nhwc -from tvm.topi.util import get_const_tuple, get_const_int, traverse_inline +from tvm.topi.utils import get_const_tuple, get_const_int, traverse_inline def conv2d_direct(*args, **kwargs): diff --git a/python/tvm/topi/arm_cpu/cortex_m7/conv2d/direct_simd.py b/python/tvm/topi/arm_cpu/cortex_m7/conv2d/direct_simd.py index 61dca8a37962..988c3a99c059 100644 --- a/python/tvm/topi/arm_cpu/cortex_m7/conv2d/direct_simd.py +++ b/python/tvm/topi/arm_cpu/cortex_m7/conv2d/direct_simd.py @@ -20,9 +20,9 @@ from tvm import autotvm from tvm.autotvm.task import deserialize_args from tvm import te -from tvm.topi.util import simplify, traverse_inline +from tvm.topi.utils import simplify, traverse_inline from tvm.topi.nn.pad import pad -from tvm.topi.nn.util import get_pad_tuple +from tvm.topi.nn.utils import get_pad_tuple from ..micro_kernel.gemm import ( intrin_gemm_MxKxN, diff --git a/python/tvm/topi/arm_cpu/depthwise_conv2d.py b/python/tvm/topi/arm_cpu/depthwise_conv2d.py index b71c0c92864c..3c32d3e1f3f2 100644 --- a/python/tvm/topi/arm_cpu/depthwise_conv2d.py +++ b/python/tvm/topi/arm_cpu/depthwise_conv2d.py @@ -23,8 +23,8 @@ from tvm.autotvm.task.space import SplitEntity, OtherOptionEntity from .. import nn -from ..util import traverse_inline, get_const_tuple, get_const_int -from ..nn.util import get_pad_tuple +from ..utils import traverse_inline, get_const_tuple, get_const_int +from ..nn.utils import get_pad_tuple @autotvm.register_topi_compute("depthwise_conv2d_nchw.arm_cpu") @@ -151,7 +151,7 @@ def _callback(op): # This schedule has incorrect result on some hardware platforms (like NV Jetson TX2) # Let us comment it out but not remove. # see discussion: -# https://discuss.tvm.ai/t/autotuner-incorrect-result-after-tuning-mobilenetv2-on-arm-cpu/6088 +# https://discuss.tvm.apache.org/t/autotuner-incorrect-result-after-tuning-mobilenetv2-on-arm-cpu/6088 @autotvm.register_topi_compute("depthwise_conv2d_nchw_spatial_pack.arm_cpu") def depthwise_conv2d_nchw_spatial_pack(cfg, data, kernel, strides, padding, dilation, out_dtype): """TOPI compute callback for depthwise_conv2d nchw diff --git a/python/tvm/topi/arm_cpu/injective.py b/python/tvm/topi/arm_cpu/injective.py index aec86bc6d525..55f47c5dee4d 100644 --- a/python/tvm/topi/arm_cpu/injective.py +++ b/python/tvm/topi/arm_cpu/injective.py @@ -18,7 +18,7 @@ """Schedule for pooling operators""" import tvm from tvm import te -from ..util import is_empty_shape +from ..utils import is_empty_shape def schedule_injective_from_existing(sch, out): diff --git a/python/tvm/topi/arm_cpu/tensor_intrin.py b/python/tvm/topi/arm_cpu/tensor_intrin.py index 73cfacb62079..196f788e6b8c 100644 --- a/python/tvm/topi/arm_cpu/tensor_intrin.py +++ b/python/tvm/topi/arm_cpu/tensor_intrin.py @@ -19,7 +19,7 @@ import tvm from tvm import te -from tvm.contrib import util, clang +from tvm.contrib import utils, clang def gemm_quantized_4_4_batched(): @@ -372,7 +372,7 @@ def gemm_quantized_impl(M, N, K, unroll, interleave, data_type="uint8"): cc_code = cc_code.replace("umull", "smull") cc_code = cc_code.replace("uadalp", "sadalp") - temp = util.tempdir() + temp = utils.tempdir() ll_path = temp.relpath("temp.ll") # Create LLVM ir from c source code ll_code = clang.create_llvm( diff --git a/python/tvm/topi/bifrost/conv2d.py b/python/tvm/topi/bifrost/conv2d.py index a3be906c250f..3b6cca6aaea4 100644 --- a/python/tvm/topi/bifrost/conv2d.py +++ b/python/tvm/topi/bifrost/conv2d.py @@ -25,7 +25,7 @@ from .gemm import decl_winograd_gemm, schedule_gemm from .transforms import tile_and_bind, tile_and_bind3d -from ..util import traverse_inline, get_const_int, get_const_tuple +from ..utils import traverse_inline, get_const_int, get_const_tuple from .. import nn from ..nn.winograd_util import winograd_transform_matrices diff --git a/python/tvm/topi/bifrost/dense.py b/python/tvm/topi/bifrost/dense.py index 85703f19ca2f..9ab8b4ebea62 100644 --- a/python/tvm/topi/bifrost/dense.py +++ b/python/tvm/topi/bifrost/dense.py @@ -20,7 +20,7 @@ from tvm import autotvm from .. import nn -from ..util import traverse_inline +from ..utils import traverse_inline @autotvm.register_topi_compute("dense.bifrost") diff --git a/python/tvm/topi/bifrost/depthwise_conv2d.py b/python/tvm/topi/bifrost/depthwise_conv2d.py index 35da5a594ec2..625c274213ad 100644 --- a/python/tvm/topi/bifrost/depthwise_conv2d.py +++ b/python/tvm/topi/bifrost/depthwise_conv2d.py @@ -22,7 +22,7 @@ import tvm from tvm import te -from .. import util +from .. import utils from .. import tag @@ -70,12 +70,12 @@ def tile_and_bind3d(tensor, z, y, x, z_factor=2, y_factor=None, x_factor=None): VH = 1 VW = 1 num_thread = 4 - while util.get_const_int(conv.shape[3]) % (VW * 2) == 0 and VW * 2 <= 4: + while utils.get_const_int(conv.shape[3]) % (VW * 2) == 0 and VW * 2 <= 4: VW = VW * 2 - while util.get_const_int(conv.shape[2]) % (VH * 2) == 0 and VH * 2 <= 2: + while utils.get_const_int(conv.shape[2]) % (VH * 2) == 0 and VH * 2 <= 2: VH = VH * 2 if raw_data.dtype == "float16": - if util.get_const_int(conv.shape[3]) % (VW * 2) == 0: + if utils.get_const_int(conv.shape[3]) % (VW * 2) == 0: VW *= 2 num_thread *= 2 else: diff --git a/python/tvm/topi/bifrost/gemm.py b/python/tvm/topi/bifrost/gemm.py index c06f62323817..6224493109ef 100644 --- a/python/tvm/topi/bifrost/gemm.py +++ b/python/tvm/topi/bifrost/gemm.py @@ -19,7 +19,7 @@ from tvm import te from .transforms import tile_and_bind, tile_and_bind3d, interleave_transpose, transpose_interleave -from .. import util +from .. import utils def decl_gemm(cfg, A, B): @@ -50,10 +50,10 @@ def decl_gemm(cfg, A, B): cfg.define_knob("split_k_factor", [1, 4, 16]) # Mutual k axis must be of equal extent - assert util.get_const_int(A.shape[1]) == util.get_const_int(B.shape[0]) + assert utils.get_const_int(A.shape[1]) == utils.get_const_int(B.shape[0]) n = A.shape[0] m = B.shape[1] - k_size = util.get_const_int(A.shape[1]) + k_size = utils.get_const_int(A.shape[1]) unroll_gemm = cfg["split_k_factor"].val if unroll_gemm == 1: # No unrolling case must have the same set of tensors to keep scheduling consistent @@ -120,8 +120,8 @@ def decl_batched_gemm(cfg, A, B): """ # Mutual b and k axis must be of equal extent - assert util.get_const_int(A.shape[2]) == util.get_const_int(B.shape[1]) - assert util.get_const_int(A.shape[0]) == util.get_const_int(B.shape[0]) + assert utils.get_const_int(A.shape[2]) == utils.get_const_int(B.shape[1]) + assert utils.get_const_int(A.shape[0]) == utils.get_const_int(B.shape[0]) cfg.define_knob("work_group_x", [1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 64]) cfg.define_knob("work_group_y", [1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 64]) @@ -131,8 +131,8 @@ def decl_batched_gemm(cfg, A, B): n = A.shape[1] m = B.shape[2] - k_size = util.get_const_int(A.shape[2]) - b_size = util.get_const_int(A.shape[0]) + k_size = utils.get_const_int(A.shape[2]) + b_size = utils.get_const_int(A.shape[0]) # Declare a batched GEMM k = te.reduce_axis((0, k_size), name="k") @@ -163,9 +163,9 @@ def decl_winograd_gemm(cfg, A, B): ------- """ - alpha = util.get_const_int(A.shape[0]) - n = util.get_const_int(A.shape[2]) - k = util.get_const_int(A.shape[3]) + alpha = utils.get_const_int(A.shape[0]) + n = utils.get_const_int(A.shape[2]) + k = utils.get_const_int(A.shape[3]) A_3D = te.compute( (alpha * alpha, n, k), lambda b, i, j: A[b // alpha][b % alpha][i][j], name="A_3D" diff --git a/python/tvm/topi/cpp/__init__.py b/python/tvm/topi/cpp/__init__.py index 62e274c4e768..bad6f0e8d452 100644 --- a/python/tvm/topi/cpp/__init__.py +++ b/python/tvm/topi/cpp/__init__.py @@ -23,4 +23,4 @@ from . import x86 from . import generic from . import rocm -from . import util +from . import utils diff --git a/python/tvm/topi/cpp/util.py b/python/tvm/topi/cpp/utils.py similarity index 93% rename from python/tvm/topi/cpp/util.py rename to python/tvm/topi/cpp/utils.py index ca0b86e5a353..60a2747f9abb 100644 --- a/python/tvm/topi/cpp/util.py +++ b/python/tvm/topi/cpp/utils.py @@ -17,4 +17,4 @@ """FFI for TOPI utility functions""" import tvm._ffi -tvm._ffi._init_api("topi.util", "tvm.topi.cpp.util") +tvm._ffi._init_api("topi.utils", "tvm.topi.cpp.utils") diff --git a/python/tvm/topi/cuda/batch_matmul.py b/python/tvm/topi/cuda/batch_matmul.py index ee94420066dd..8d34b2996593 100644 --- a/python/tvm/topi/cuda/batch_matmul.py +++ b/python/tvm/topi/cuda/batch_matmul.py @@ -22,7 +22,7 @@ from tvm.contrib import cublas from tvm.autotvm.task.space import SplitEntity, OtherOptionEntity from .. import nn -from ..util import traverse_inline, get_const_tuple, get_max_power2_factor +from ..utils import traverse_inline, get_const_tuple, get_max_power2_factor @autotvm.register_topi_compute("batch_matmul.cuda") diff --git a/python/tvm/topi/cuda/conv1d.py b/python/tvm/topi/cuda/conv1d.py index 416e4803a7f0..e50913d88df2 100644 --- a/python/tvm/topi/cuda/conv1d.py +++ b/python/tvm/topi/cuda/conv1d.py @@ -21,7 +21,7 @@ from tvm import autotvm from .. import nn -from ..util import traverse_inline, get_const_tuple +from ..utils import traverse_inline, get_const_tuple @autotvm.register_topi_compute("conv1d_ncw.cuda") diff --git a/python/tvm/topi/cuda/conv1d_transpose_ncw.py b/python/tvm/topi/cuda/conv1d_transpose_ncw.py index c827007f3aec..1ddbdcca9b36 100644 --- a/python/tvm/topi/cuda/conv1d_transpose_ncw.py +++ b/python/tvm/topi/cuda/conv1d_transpose_ncw.py @@ -21,7 +21,7 @@ from tvm import te from tvm import autotvm from .. import nn -from ..util import get_const_tuple, traverse_inline +from ..utils import get_const_tuple, traverse_inline @autotvm.task.register_topi_compute("conv1d_transpose_nchw.cuda") diff --git a/python/tvm/topi/cuda/conv2d.py b/python/tvm/topi/cuda/conv2d.py index cf335acfb98d..ce9cebc3c963 100644 --- a/python/tvm/topi/cuda/conv2d.py +++ b/python/tvm/topi/cuda/conv2d.py @@ -22,8 +22,8 @@ from tvm.contrib import cudnn from .. import nn, generic -from ..nn.util import get_pad_tuple -from ..util import get_const_tuple, traverse_inline +from ..nn.utils import get_pad_tuple +from ..utils import get_const_tuple, traverse_inline from .conv2d_direct import schedule_direct_cuda from .conv2d_nhwc import schedule_conv2d_nhwc_direct diff --git a/python/tvm/topi/cuda/conv2d_alter_op.py b/python/tvm/topi/cuda/conv2d_alter_op.py index 9bac87c32cff..609ead3e6398 100644 --- a/python/tvm/topi/cuda/conv2d_alter_op.py +++ b/python/tvm/topi/cuda/conv2d_alter_op.py @@ -24,7 +24,7 @@ from tvm import autotvm from .. import nn -from ..util import get_const_tuple +from ..utils import get_const_tuple from .conv2d_winograd import _infer_tile_size from ..nn import conv2d_legalize diff --git a/python/tvm/topi/cuda/conv2d_direct.py b/python/tvm/topi/cuda/conv2d_direct.py index e1f3d82cb3e9..2dc6635e680e 100644 --- a/python/tvm/topi/cuda/conv2d_direct.py +++ b/python/tvm/topi/cuda/conv2d_direct.py @@ -19,7 +19,7 @@ import tvm from tvm import te from tvm import autotvm -from ..util import get_const_tuple +from ..utils import get_const_tuple def schedule_direct_cuda(cfg, s, conv): diff --git a/python/tvm/topi/cuda/conv2d_hwnc_tensorcore.py b/python/tvm/topi/cuda/conv2d_hwnc_tensorcore.py index db5a6c9863f2..e2d3cd927a6e 100644 --- a/python/tvm/topi/cuda/conv2d_hwnc_tensorcore.py +++ b/python/tvm/topi/cuda/conv2d_hwnc_tensorcore.py @@ -22,9 +22,9 @@ from tvm import autotvm from tvm.target import Target from tvm.topi.cuda.injective import schedule_injective_from_existing -from ..util import get_const_tuple, traverse_inline, simplify, tag +from ..utils import get_const_tuple, traverse_inline, simplify, tag from ..nn.pad import pad -from ..nn.util import get_pad_tuple +from ..nn.utils import get_pad_tuple from .tensor_intrin import intrin_wmma_load_matrix_A from .tensor_intrin import intrin_wmma_load_matrix_W from .tensor_intrin import intrin_wmma_store_matrix diff --git a/python/tvm/topi/cuda/conv2d_int8.py b/python/tvm/topi/cuda/conv2d_int8.py index deeec50f6d71..50a0e8b71661 100644 --- a/python/tvm/topi/cuda/conv2d_int8.py +++ b/python/tvm/topi/cuda/conv2d_int8.py @@ -25,8 +25,8 @@ from .tensor_intrin import dp4a from ..nn.pad import pad from ..nn.conv2d import unpack_NCHWc_to_nchw -from ..nn.util import get_pad_tuple -from ..util import get_const_tuple, traverse_inline +from ..nn.utils import get_pad_tuple +from ..utils import get_const_tuple, traverse_inline def conv2d_nchw_int8(data, kernel, strides, padding, dilation, out_dtype="int32"): diff --git a/python/tvm/topi/cuda/conv2d_nhwc.py b/python/tvm/topi/cuda/conv2d_nhwc.py index b25634586a69..a08d217696e2 100644 --- a/python/tvm/topi/cuda/conv2d_nhwc.py +++ b/python/tvm/topi/cuda/conv2d_nhwc.py @@ -19,7 +19,7 @@ import tvm from tvm import te from tvm import autotvm -from ..util import get_const_tuple +from ..utils import get_const_tuple def schedule_conv2d_nhwc_direct(cfg, s, Conv): diff --git a/python/tvm/topi/cuda/conv2d_nhwc_tensorcore.py b/python/tvm/topi/cuda/conv2d_nhwc_tensorcore.py index a33092d2ff22..f665cc779dc5 100644 --- a/python/tvm/topi/cuda/conv2d_nhwc_tensorcore.py +++ b/python/tvm/topi/cuda/conv2d_nhwc_tensorcore.py @@ -21,9 +21,9 @@ import tvm from tvm import te from tvm import autotvm -from ..util import get_const_tuple, traverse_inline, simplify +from ..utils import get_const_tuple, traverse_inline, simplify from ..nn.pad import pad -from ..nn.util import get_pad_tuple +from ..nn.utils import get_pad_tuple from .tensor_intrin import intrin_wmma_load_matrix_A from .tensor_intrin import intrin_wmma_load_matrix_W from .tensor_intrin import intrin_wmma_store_matrix diff --git a/python/tvm/topi/cuda/conv2d_nhwc_winograd.py b/python/tvm/topi/cuda/conv2d_nhwc_winograd.py index 246437a26146..1e368f585354 100644 --- a/python/tvm/topi/cuda/conv2d_nhwc_winograd.py +++ b/python/tvm/topi/cuda/conv2d_nhwc_winograd.py @@ -23,7 +23,7 @@ from tvm import te from tvm import autotvm from .. import nn -from ..util import get_const_int, get_const_tuple, traverse_inline +from ..utils import get_const_int, get_const_tuple, traverse_inline from ..nn.winograd_util import winograd_transform_matrices from .tensor_intrin import intrin_wmma_load_matrix_A from .tensor_intrin import intrin_wmma_load_matrix_W diff --git a/python/tvm/topi/cuda/conv2d_transpose_nchw.py b/python/tvm/topi/cuda/conv2d_transpose_nchw.py index 915e6cdecae2..609d1acc78bd 100644 --- a/python/tvm/topi/cuda/conv2d_transpose_nchw.py +++ b/python/tvm/topi/cuda/conv2d_transpose_nchw.py @@ -22,7 +22,7 @@ from tvm import autotvm from tvm.autotvm.task.space import SplitEntity, OtherOptionEntity from .. import nn -from ..util import get_const_tuple, traverse_inline +from ..utils import get_const_tuple, traverse_inline @autotvm.register_topi_compute("conv2d_transpose_nchw.cuda") diff --git a/python/tvm/topi/cuda/conv2d_winograd.py b/python/tvm/topi/cuda/conv2d_winograd.py index 11502e134fd5..407f05e64912 100644 --- a/python/tvm/topi/cuda/conv2d_winograd.py +++ b/python/tvm/topi/cuda/conv2d_winograd.py @@ -23,7 +23,7 @@ from tvm import autotvm from .. import nn -from ..util import get_const_int, get_const_tuple, traverse_inline +from ..utils import get_const_int, get_const_tuple, traverse_inline from ..nn.winograd_util import winograd_transform_matrices diff --git a/python/tvm/topi/cuda/conv3d.py b/python/tvm/topi/cuda/conv3d.py index 98f351bb53d4..e5a3a53a89ff 100644 --- a/python/tvm/topi/cuda/conv3d.py +++ b/python/tvm/topi/cuda/conv3d.py @@ -21,7 +21,7 @@ from tvm.contrib import cudnn from .. import nn, generic -from ..util import get_const_tuple, traverse_inline +from ..utils import get_const_tuple, traverse_inline from .conv3d_direct import schedule_direct_conv3d_cuda diff --git a/python/tvm/topi/cuda/conv3d_alter_op.py b/python/tvm/topi/cuda/conv3d_alter_op.py index 2dfba508e281..faf73e77255a 100644 --- a/python/tvm/topi/cuda/conv3d_alter_op.py +++ b/python/tvm/topi/cuda/conv3d_alter_op.py @@ -24,7 +24,7 @@ from tvm import autotvm from .. import nn -from ..util import get_const_tuple +from ..utils import get_const_tuple from .conv3d_winograd import _infer_tile_size logger = logging.getLogger("topi") diff --git a/python/tvm/topi/cuda/conv3d_direct.py b/python/tvm/topi/cuda/conv3d_direct.py index aa13e6b9a0f4..faccb75badd6 100644 --- a/python/tvm/topi/cuda/conv3d_direct.py +++ b/python/tvm/topi/cuda/conv3d_direct.py @@ -19,7 +19,7 @@ import tvm from tvm import te from tvm import autotvm -from ..util import get_const_tuple +from ..utils import get_const_tuple def schedule_direct_conv3d_cuda(cfg, s, conv, layout, workload_name): diff --git a/python/tvm/topi/cuda/conv3d_ndhwc_tensorcore.py b/python/tvm/topi/cuda/conv3d_ndhwc_tensorcore.py index b253130268aa..a5c4e81a4dc3 100644 --- a/python/tvm/topi/cuda/conv3d_ndhwc_tensorcore.py +++ b/python/tvm/topi/cuda/conv3d_ndhwc_tensorcore.py @@ -21,9 +21,9 @@ import tvm from tvm import te from tvm import autotvm -from ..util import get_const_tuple, traverse_inline, simplify +from ..utils import get_const_tuple, traverse_inline, simplify from ..nn.pad import pad -from ..nn.util import get_pad_tuple3d +from ..nn.utils import get_pad_tuple3d from .tensor_intrin import intrin_wmma_load_matrix_A from .tensor_intrin import intrin_wmma_load_matrix_W from .tensor_intrin import intrin_wmma_store_matrix diff --git a/python/tvm/topi/cuda/conv3d_transpose_ncdhw.py b/python/tvm/topi/cuda/conv3d_transpose_ncdhw.py index 69c0e0f733ea..3ad85b9bbee7 100644 --- a/python/tvm/topi/cuda/conv3d_transpose_ncdhw.py +++ b/python/tvm/topi/cuda/conv3d_transpose_ncdhw.py @@ -21,7 +21,7 @@ from tvm import te from tvm import autotvm from .. import nn -from ..util import get_const_tuple, traverse_inline +from ..utils import get_const_tuple, traverse_inline from .conv3d_direct import schedule_direct_conv3d_cuda diff --git a/python/tvm/topi/cuda/conv3d_winograd.py b/python/tvm/topi/cuda/conv3d_winograd.py index 7f4f13979976..2134ee9178b8 100644 --- a/python/tvm/topi/cuda/conv3d_winograd.py +++ b/python/tvm/topi/cuda/conv3d_winograd.py @@ -23,7 +23,7 @@ from tvm import autotvm from .. import nn -from ..util import get_const_int, get_const_tuple, traverse_inline, simplify +from ..utils import get_const_int, get_const_tuple, traverse_inline, simplify from ..nn.winograd_util import winograd_transform_matrices logger = logging.getLogger("conv3d_winograd") diff --git a/python/tvm/topi/cuda/correlation.py b/python/tvm/topi/cuda/correlation.py index 12f564409c12..9b1698329fd3 100644 --- a/python/tvm/topi/cuda/correlation.py +++ b/python/tvm/topi/cuda/correlation.py @@ -20,7 +20,7 @@ from tvm import autotvm from .. import nn -from ..util import traverse_inline +from ..utils import traverse_inline @autotvm.register_topi_compute("correlation_nchw.cuda") diff --git a/python/tvm/topi/cuda/deformable_conv2d.py b/python/tvm/topi/cuda/deformable_conv2d.py index 365fde541501..911588cad5a3 100644 --- a/python/tvm/topi/cuda/deformable_conv2d.py +++ b/python/tvm/topi/cuda/deformable_conv2d.py @@ -20,7 +20,7 @@ from tvm import te from tvm import autotvm from .. import nn -from ..util import traverse_inline +from ..utils import traverse_inline @autotvm.register_topi_compute("deformable_conv2d_nchw.cuda") diff --git a/python/tvm/topi/cuda/dense.py b/python/tvm/topi/cuda/dense.py index 727992d76529..47b9db4f390a 100644 --- a/python/tvm/topi/cuda/dense.py +++ b/python/tvm/topi/cuda/dense.py @@ -25,7 +25,7 @@ from .. import nn from .. import tag from .. import generic -from ..util import traverse_inline, get_const_tuple +from ..utils import traverse_inline, get_const_tuple logger = logging.getLogger("topi") diff --git a/python/tvm/topi/cuda/dense_tensorcore.py b/python/tvm/topi/cuda/dense_tensorcore.py index 99f28a1fc4e6..a59ebd7347bb 100644 --- a/python/tvm/topi/cuda/dense_tensorcore.py +++ b/python/tvm/topi/cuda/dense_tensorcore.py @@ -21,7 +21,7 @@ from tvm import te import tvm.autotvm as autotvm from .. import tag -from ..util import traverse_inline, get_const_tuple +from ..utils import traverse_inline, get_const_tuple from .tensor_intrin import ( intrin_wmma_load_matrix_A, intrin_wmma_load_matrix_W, diff --git a/python/tvm/topi/cuda/depthwise_conv2d.py b/python/tvm/topi/cuda/depthwise_conv2d.py index 2908439f0a20..90a7371cb70b 100644 --- a/python/tvm/topi/cuda/depthwise_conv2d.py +++ b/python/tvm/topi/cuda/depthwise_conv2d.py @@ -19,7 +19,7 @@ import tvm from tvm import te from tvm import autotvm -from ..util import traverse_inline +from ..utils import traverse_inline from .. import tag from .. import nn diff --git a/python/tvm/topi/cuda/group_conv2d_nchw.py b/python/tvm/topi/cuda/group_conv2d_nchw.py index 35d511977fa9..2af011700235 100644 --- a/python/tvm/topi/cuda/group_conv2d_nchw.py +++ b/python/tvm/topi/cuda/group_conv2d_nchw.py @@ -23,8 +23,8 @@ from .injective import schedule_injective_from_existing from .tensor_intrin import dp4a from ..nn.pad import pad -from ..nn.util import get_pad_tuple -from ..util import traverse_inline, get_const_tuple, get_const_int +from ..nn.utils import get_pad_tuple +from ..utils import traverse_inline, get_const_tuple, get_const_int from .. import nn diff --git a/python/tvm/topi/cuda/injective.py b/python/tvm/topi/cuda/injective.py index 8a5f618f76ab..60fb12e4975e 100644 --- a/python/tvm/topi/cuda/injective.py +++ b/python/tvm/topi/cuda/injective.py @@ -18,7 +18,7 @@ """Schedule for composition of injective operator""" import tvm from tvm import te -from .. import util +from .. import utils def schedule_injective_from_existing(sch, out): @@ -45,7 +45,7 @@ def schedule_injective_from_existing(sch, out): vector_width = 4 if out.dtype == "float16" else 1 try: - const_size = util.get_const_int(util.prod(out.shape)) + const_size = utils.get_const_int(utils.prod(out.shape)) need_block_split = const_size > max_block * num_thread * vector_width except ValueError: need_block_split = False @@ -87,7 +87,7 @@ def schedule_injective(outs): tvm.te.schedule.AutoInlineInjective(s) for out in outs: - if not util.is_empty_shape(out.shape): + if not utils.is_empty_shape(out.shape): schedule_injective_from_existing(s, out) return s diff --git a/python/tvm/topi/cuda/pooling.py b/python/tvm/topi/cuda/pooling.py index a3caf5f45151..f2a6aadb659f 100644 --- a/python/tvm/topi/cuda/pooling.py +++ b/python/tvm/topi/cuda/pooling.py @@ -19,7 +19,7 @@ import tvm from tvm import te from .. import tag -from ..util import traverse_inline +from ..utils import traverse_inline def schedule_adaptive_pool(outs, layout="NCHW"): diff --git a/python/tvm/topi/cuda/rcnn/proposal.py b/python/tvm/topi/cuda/rcnn/proposal.py index 119b7bd2a74f..5b7884c7363b 100644 --- a/python/tvm/topi/cuda/rcnn/proposal.py +++ b/python/tvm/topi/cuda/rcnn/proposal.py @@ -20,7 +20,7 @@ import tvm from tvm import te from ...vision.rcnn import generate_anchor, reg_bbox, reg_iou -from ...util import get_const_tuple, get_const_int +from ...utils import get_const_tuple, get_const_int def predict_bbox_ir( diff --git a/python/tvm/topi/cuda/sparse.py b/python/tvm/topi/cuda/sparse.py index 3fd6fbebc62f..d125423968a9 100644 --- a/python/tvm/topi/cuda/sparse.py +++ b/python/tvm/topi/cuda/sparse.py @@ -23,7 +23,7 @@ from tvm import relay, te from .. import nn -from ..util import traverse_inline +from ..utils import traverse_inline def sparse_dense(data, weight_data, weight_indices, weight_indptr): diff --git a/python/tvm/topi/generic/conv2d.py b/python/tvm/topi/generic/conv2d.py index 122d7d27b60d..f23cff3bef84 100644 --- a/python/tvm/topi/generic/conv2d.py +++ b/python/tvm/topi/generic/conv2d.py @@ -20,7 +20,7 @@ from tvm import te from tvm import autotvm from tvm.autotvm.task.space import SplitEntity, OtherOptionEntity -from ..util import get_const_tuple +from ..utils import get_const_tuple def fallback_schedule_cpu_common_int8(cfg, wkl, int32_lanes, num_int8_elements): diff --git a/python/tvm/topi/image/dilation2d.py b/python/tvm/topi/image/dilation2d.py index b3887822c452..7aad50623164 100644 --- a/python/tvm/topi/image/dilation2d.py +++ b/python/tvm/topi/image/dilation2d.py @@ -19,9 +19,9 @@ """Dilation2D operators""" from __future__ import absolute_import as _abs from tvm import te -from tvm.topi.util import simplify +from tvm.topi.utils import simplify from ..nn.pad import pad -from ..nn.util import get_pad_tuple +from ..nn.utils import get_pad_tuple def dilation2d_nchw(input, filter, stride, padding, dilations, out_dtype=None): diff --git a/python/tvm/topi/image/resize.py b/python/tvm/topi/image/resize.py index ca9904492239..103850de4923 100644 --- a/python/tvm/topi/image/resize.py +++ b/python/tvm/topi/image/resize.py @@ -19,7 +19,7 @@ from __future__ import absolute_import import tvm from tvm import te -from tvm.topi.util import nchw_pack_layout, nchw_xc_layout +from tvm.topi.utils import nchw_pack_layout, nchw_xc_layout from .. import tag diff --git a/python/tvm/topi/intel_graphics/conv2d.py b/python/tvm/topi/intel_graphics/conv2d.py index 5bd8581e21c2..bdbde91918dd 100644 --- a/python/tvm/topi/intel_graphics/conv2d.py +++ b/python/tvm/topi/intel_graphics/conv2d.py @@ -25,8 +25,8 @@ from tvm.autotvm.task.space import SplitEntity, OtherOptionEntity from .. import nn -from .. import util -from ..util import simplify, get_const_tuple, traverse_inline +from .. import utils +from ..utils import simplify, get_const_tuple, traverse_inline def _get_default_config(cfg, data, kernel, strides, padding, out_dtype, is_depthwise=False): @@ -487,8 +487,8 @@ def _callback(op): def _decl_cl_spatialpack(data, kernel, stride, padding, out_dtype="float16"): - batch, in_channel, in_height, in_width = [util.get_const_int(x) for x in data.shape] - num_filter, channel, kernel_h, kernel_w = [util.get_const_int(x) for x in kernel.shape] + batch, in_channel, in_height, in_width = [utils.get_const_int(x) for x in data.shape] + num_filter, channel, kernel_h, kernel_w = [utils.get_const_int(x) for x in kernel.shape] pad_top, pad_left, pad_down, pad_right = nn.get_pad_tuple(padding, (kernel_h, kernel_w)) if isinstance(stride, (tuple, list)): @@ -574,7 +574,7 @@ def _decl_cl_spatialpack(data, kernel, stride, padding, out_dtype="float16"): def _schedule_cl_spatialpack(s, op): output = op.output(0) - _, _, out_height, out_width = [util.get_const_int(x) for x in output.shape] + _, _, out_height, out_width = [utils.get_const_int(x) for x in output.shape] conv = op.input_tensors[0] temp = s[conv].op.input_tensors[0] @@ -584,7 +584,7 @@ def _schedule_cl_spatialpack(s, op): conv_L = s.cache_write(conv, "local") kernel_L = s.cache_read(kernel_vec, "local", [conv_L]) - _, in_channel, temp_h, temp_w = [util.get_const_int(x) for x in temp.shape] + _, in_channel, temp_h, temp_w = [utils.get_const_int(x) for x in temp.shape] attrs = s[conv].op.attrs OUTPUT_BLOCK_HEIGHT = attrs["block_h"] diff --git a/python/tvm/topi/intel_graphics/conv2d_alter_op.py b/python/tvm/topi/intel_graphics/conv2d_alter_op.py index 46802bba806f..0b59a849c2c9 100644 --- a/python/tvm/topi/intel_graphics/conv2d_alter_op.py +++ b/python/tvm/topi/intel_graphics/conv2d_alter_op.py @@ -22,7 +22,7 @@ from tvm import relay from tvm import autotvm -from ..util import get_const_tuple +from ..utils import get_const_tuple from ..nn import conv2d_alter_layout, conv2d_infer_layout from .conv2d import _get_default_config diff --git a/python/tvm/topi/intel_graphics/depthwise_conv2d.py b/python/tvm/topi/intel_graphics/depthwise_conv2d.py index e2367798d6cb..fabd63b8778c 100644 --- a/python/tvm/topi/intel_graphics/depthwise_conv2d.py +++ b/python/tvm/topi/intel_graphics/depthwise_conv2d.py @@ -19,7 +19,7 @@ import tvm from tvm import te from tvm import autotvm -from ..util import traverse_inline +from ..utils import traverse_inline from .. import tag from .. import nn from ..nn.depthwise_conv2d import depthwise_conv2d_infer_layout diff --git a/python/tvm/topi/mali/conv2d.py b/python/tvm/topi/mali/conv2d.py index 0ccf1e671e8c..eb4005eb37c7 100644 --- a/python/tvm/topi/mali/conv2d.py +++ b/python/tvm/topi/mali/conv2d.py @@ -22,7 +22,7 @@ from tvm import autotvm from tvm.autotvm.task.space import get_factors -from ..util import traverse_inline, get_const_int, get_const_tuple +from ..utils import traverse_inline, get_const_int, get_const_tuple from .. import nn from ..nn.winograd_util import winograd_transform_matrices diff --git a/python/tvm/topi/mali/dense.py b/python/tvm/topi/mali/dense.py index 7605acebe7c6..53f76219bacd 100644 --- a/python/tvm/topi/mali/dense.py +++ b/python/tvm/topi/mali/dense.py @@ -20,7 +20,7 @@ from tvm import autotvm from .. import nn -from ..util import traverse_inline +from ..utils import traverse_inline @autotvm.register_topi_compute("dense.mali") diff --git a/python/tvm/topi/mali/depthwise_conv2d.py b/python/tvm/topi/mali/depthwise_conv2d.py index b64135c969e6..55fcb1de9c4a 100644 --- a/python/tvm/topi/mali/depthwise_conv2d.py +++ b/python/tvm/topi/mali/depthwise_conv2d.py @@ -22,7 +22,7 @@ from tvm import autotvm from .. import nn -from ..util import traverse_inline +from ..utils import traverse_inline # register original implementation of depthwise_conv2d_nchw since we don't need to change this part @autotvm.register_topi_compute("depthwise_conv2d_nchw.mali") diff --git a/python/tvm/topi/nn/batch_matmul.py b/python/tvm/topi/nn/batch_matmul.py index 9b926a1182d8..6e60f27eab5d 100644 --- a/python/tvm/topi/nn/batch_matmul.py +++ b/python/tvm/topi/nn/batch_matmul.py @@ -17,7 +17,7 @@ """Binary Neural Network (BNN) Operators""" # pylint: disable=invalid-name from tvm import te -from ..util import get_const_tuple +from ..utils import get_const_tuple def batch_matmul(x, y, oshape=None): diff --git a/python/tvm/topi/nn/bitserial_conv2d.py b/python/tvm/topi/nn/bitserial_conv2d.py index d10451902789..78d05d027659 100644 --- a/python/tvm/topi/nn/bitserial_conv2d.py +++ b/python/tvm/topi/nn/bitserial_conv2d.py @@ -20,9 +20,9 @@ import tvm from tvm import te from .pad import pad -from .util import get_pad_tuple +from .utils import get_pad_tuple from .bitserial_util import bitpack -from ..util import get_const_tuple +from ..utils import get_const_tuple def bitserial_conv2d_nchw( diff --git a/python/tvm/topi/nn/bitserial_dense.py b/python/tvm/topi/nn/bitserial_dense.py index 0b86e2e17392..32154ac81910 100644 --- a/python/tvm/topi/nn/bitserial_dense.py +++ b/python/tvm/topi/nn/bitserial_dense.py @@ -19,7 +19,7 @@ from __future__ import absolute_import import tvm from tvm import te -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple from .bitserial_util import bitpack diff --git a/python/tvm/topi/nn/bitserial_util.py b/python/tvm/topi/nn/bitserial_util.py index ae43668484b3..3a55422493d4 100644 --- a/python/tvm/topi/nn/bitserial_util.py +++ b/python/tvm/topi/nn/bitserial_util.py @@ -20,7 +20,7 @@ import tvm from tvm import te from tvm.topi.transform import concatenate -from ..util import get_const_int +from ..utils import get_const_int def bitpack(data, bits, pack_axis, bit_axis, pack_type, name="QuantizeInput"): diff --git a/python/tvm/topi/nn/bnn.py b/python/tvm/topi/nn/bnn.py index 6c36b375f157..50539de10052 100644 --- a/python/tvm/topi/nn/bnn.py +++ b/python/tvm/topi/nn/bnn.py @@ -19,7 +19,7 @@ import tvm from tvm import te from .. import tag -from ..util import simplify, get_const_int +from ..utils import simplify, get_const_int def binarize_pack(data, axis=None, name="PackedInput"): diff --git a/python/tvm/topi/nn/conv1d.py b/python/tvm/topi/nn/conv1d.py index cffed669f20a..8fdf3f8918ee 100644 --- a/python/tvm/topi/nn/conv1d.py +++ b/python/tvm/topi/nn/conv1d.py @@ -18,8 +18,8 @@ """1D convolution operators.""" from tvm import te from .pad import pad -from ..util import simplify -from .util import get_pad_tuple1d +from ..utils import simplify +from .utils import get_pad_tuple1d def conv1d(data, kernel, strides=1, padding="VALID", dilation=1, layout="NCW", out_dtype=None): diff --git a/python/tvm/topi/nn/conv1d_transpose.py b/python/tvm/topi/nn/conv1d_transpose.py index 813377e76ca6..6f040409f47c 100644 --- a/python/tvm/topi/nn/conv1d_transpose.py +++ b/python/tvm/topi/nn/conv1d_transpose.py @@ -19,8 +19,8 @@ from tvm import te from .dilate import dilate from .pad import pad -from ..util import simplify -from .util import get_pad_tuple1d +from ..utils import simplify +from .utils import get_pad_tuple1d def conv1d_transpose_ncw(data, kernel, stride, padding, out_dtype, output_padding): diff --git a/python/tvm/topi/nn/conv2d.py b/python/tvm/topi/nn/conv2d.py index c0e941c4acc7..2e147fc148de 100644 --- a/python/tvm/topi/nn/conv2d.py +++ b/python/tvm/topi/nn/conv2d.py @@ -23,8 +23,8 @@ from tvm import te from .pad import pad -from .util import get_pad_tuple -from ..util import simplify, get_const_tuple, get_const_int, tag +from .utils import get_pad_tuple +from ..utils import simplify, get_const_tuple, get_const_int, tag from .winograd_util import winograd_transform_matrices # workload description of conv2d diff --git a/python/tvm/topi/nn/conv2d_transpose.py b/python/tvm/topi/nn/conv2d_transpose.py index f67f9c9c8a5a..22188bcd45a4 100644 --- a/python/tvm/topi/nn/conv2d_transpose.py +++ b/python/tvm/topi/nn/conv2d_transpose.py @@ -21,8 +21,8 @@ from tvm import relay from .dilate import dilate from .pad import pad -from .util import get_pad_tuple -from ..util import simplify +from .utils import get_pad_tuple +from ..utils import simplify def conv2d_transpose_nchw(Input, Filter, strides, padding, out_dtype, output_padding): diff --git a/python/tvm/topi/nn/conv3d.py b/python/tvm/topi/nn/conv3d.py index 1696ac663e95..f3cda2896f63 100644 --- a/python/tvm/topi/nn/conv3d.py +++ b/python/tvm/topi/nn/conv3d.py @@ -21,8 +21,8 @@ from tvm import te from .pad import pad -from .util import get_pad_tuple3d -from ..util import simplify, get_const_tuple +from .utils import get_pad_tuple3d +from ..utils import simplify, get_const_tuple from .winograd_util import winograd_transform_matrices diff --git a/python/tvm/topi/nn/conv3d_transpose.py b/python/tvm/topi/nn/conv3d_transpose.py index 9a8828f7cbbd..9f5c01a1fc3b 100644 --- a/python/tvm/topi/nn/conv3d_transpose.py +++ b/python/tvm/topi/nn/conv3d_transpose.py @@ -21,8 +21,8 @@ from tvm import relay from .dilate import dilate from .pad import pad -from .util import get_pad_tuple3d -from ..util import simplify +from .utils import get_pad_tuple3d +from ..utils import simplify def conv3d_transpose_ncdhw(Input, Filter, strides, padding, out_dtype, output_padding): diff --git a/python/tvm/topi/nn/correlation.py b/python/tvm/topi/nn/correlation.py index 583002e7fc83..d7d650cd965e 100644 --- a/python/tvm/topi/nn/correlation.py +++ b/python/tvm/topi/nn/correlation.py @@ -18,7 +18,7 @@ from tvm import te from .pad import pad -from ..util import get_const_tuple +from ..utils import get_const_tuple def correlation_nchw( diff --git a/python/tvm/topi/nn/deformable_conv2d.py b/python/tvm/topi/nn/deformable_conv2d.py index 3d2b7ce3f14e..a8c2745b1c77 100644 --- a/python/tvm/topi/nn/deformable_conv2d.py +++ b/python/tvm/topi/nn/deformable_conv2d.py @@ -19,9 +19,9 @@ import tvm from tvm import te -from .util import get_pad_tuple -from ..util import get_const_tuple -from ..cpp.util import bilinear_sample_nchw +from .utils import get_pad_tuple +from ..utils import get_const_tuple +from ..cpp.utils import bilinear_sample_nchw def deformable_conv2d_nchw( diff --git a/python/tvm/topi/nn/depthwise_conv2d.py b/python/tvm/topi/nn/depthwise_conv2d.py index c863a157025b..72356821770d 100644 --- a/python/tvm/topi/nn/depthwise_conv2d.py +++ b/python/tvm/topi/nn/depthwise_conv2d.py @@ -23,8 +23,8 @@ from .dilate import dilate from .pad import pad -from .util import get_pad_tuple -from ..util import simplify +from .utils import get_pad_tuple +from ..utils import simplify # workload description of depthwise-conv2d Workload = namedtuple( diff --git a/python/tvm/topi/nn/dilate.py b/python/tvm/topi/nn/dilate.py index 6980fea58173..6b2222e4a779 100644 --- a/python/tvm/topi/nn/dilate.py +++ b/python/tvm/topi/nn/dilate.py @@ -18,7 +18,7 @@ """Dilation operators""" import tvm from tvm import te -from .. import util +from .. import utils from .. import tag @@ -57,7 +57,7 @@ def _dilate(*indices): idxdiv = tvm.tir.indexdiv idxmod = tvm.tir.indexmod for i in range(n): - if not util.equal_const_int(strides[i], 1): + if not utils.equal_const_int(strides[i], 1): index_tuple.append(idxdiv(indices[i], strides[i])) not_zero.append(idxmod(indices[i], strides[i]).equal(0)) else: diff --git a/python/tvm/topi/nn/elemwise.py b/python/tvm/topi/nn/elemwise.py index 03fffc76ab99..a80047d900f3 100644 --- a/python/tvm/topi/nn/elemwise.py +++ b/python/tvm/topi/nn/elemwise.py @@ -19,7 +19,7 @@ import tvm from tvm import te from .. import tag -from ..util import get_const_int +from ..utils import get_const_int @tvm.te.tag_scope(tag=tag.ELEMWISE) diff --git a/python/tvm/topi/nn/pad.py b/python/tvm/topi/nn/pad.py index ec20ef6f0a13..78e41b5af92a 100644 --- a/python/tvm/topi/nn/pad.py +++ b/python/tvm/topi/nn/pad.py @@ -18,7 +18,7 @@ from __future__ import absolute_import as _abs import tvm from tvm import te -from ..util import equal_const_int +from ..utils import equal_const_int from .. import tag diff --git a/python/tvm/topi/nn/sparse.py b/python/tvm/topi/nn/sparse.py index 74a9ad5fd650..55b3e6a7d1e5 100644 --- a/python/tvm/topi/nn/sparse.py +++ b/python/tvm/topi/nn/sparse.py @@ -20,7 +20,7 @@ import tvm from tvm import te -from ..util import get_const_tuple +from ..utils import get_const_tuple def sparse_dense(data, weight_data, weight_indices, weight_indptr): diff --git a/python/tvm/topi/nn/upsampling.py b/python/tvm/topi/nn/upsampling.py index b390b803b516..b95835f6e103 100644 --- a/python/tvm/topi/nn/upsampling.py +++ b/python/tvm/topi/nn/upsampling.py @@ -17,7 +17,7 @@ """TVM operator upsampling compute.""" from tvm import topi from tvm import te -from ..util import simplify +from ..utils import simplify def upsampling( diff --git a/python/tvm/topi/nn/util.py b/python/tvm/topi/nn/utils.py similarity index 99% rename from python/tvm/topi/nn/util.py rename to python/tvm/topi/nn/utils.py index 0894656dcf54..ff00441e9850 100644 --- a/python/tvm/topi/nn/util.py +++ b/python/tvm/topi/nn/utils.py @@ -19,7 +19,7 @@ from __future__ import absolute_import import tvm -from ..util import get_const_int +from ..utils import get_const_int def infer_pad(data, data_pad): diff --git a/python/tvm/topi/nn/winograd_util.py b/python/tvm/topi/nn/winograd_util.py index d43586dbd0d7..c0f7097a6315 100644 --- a/python/tvm/topi/nn/winograd_util.py +++ b/python/tvm/topi/nn/winograd_util.py @@ -26,7 +26,7 @@ from functools import reduce import numpy as np from tvm.contrib.pickle_memoize import memoize -from ..util import const_matrix +from ..utils import const_matrix # pylint: disable=invalid-name diff --git a/python/tvm/topi/rocm/batch_matmul.py b/python/tvm/topi/rocm/batch_matmul.py index fa4dd457f3ed..7f35f4b55620 100644 --- a/python/tvm/topi/rocm/batch_matmul.py +++ b/python/tvm/topi/rocm/batch_matmul.py @@ -19,7 +19,7 @@ from tvm import autotvm from tvm.contrib import rocblas from .. import generic -from ..util import get_const_tuple +from ..utils import get_const_tuple @autotvm.register_topi_compute("batch_matmul_rocblas.rocm") diff --git a/python/tvm/topi/rocm/conv2d.py b/python/tvm/topi/rocm/conv2d.py index 0857d093535c..fac77f02b456 100644 --- a/python/tvm/topi/rocm/conv2d.py +++ b/python/tvm/topi/rocm/conv2d.py @@ -20,8 +20,8 @@ from tvm.contrib import miopen from .. import generic -from ..util import get_const_tuple -from ..nn.util import get_pad_tuple +from ..utils import get_const_tuple +from ..nn.utils import get_pad_tuple @autotvm.register_topi_compute("conv2d_nchw_miopen.rocm") diff --git a/python/tvm/topi/rocm/dense.py b/python/tvm/topi/rocm/dense.py index 4a771c602f59..2f3ce77cc7ba 100644 --- a/python/tvm/topi/rocm/dense.py +++ b/python/tvm/topi/rocm/dense.py @@ -21,7 +21,7 @@ from tvm.contrib import rocblas from .. import generic, nn from .. import tag -from ..util import traverse_inline +from ..utils import traverse_inline @autotvm.register_topi_compute("dense.rocm") diff --git a/python/tvm/topi/sort.py b/python/tvm/topi/sort.py index 86e2bad591d9..98a1080660fb 100644 --- a/python/tvm/topi/sort.py +++ b/python/tvm/topi/sort.py @@ -18,7 +18,7 @@ """Argsort operator""" import tvm from tvm import te -from .util import get_const_tuple +from .utils import get_const_tuple def argsort(data, valid_count=None, axis=-1, is_ascend=1, dtype="float32"): diff --git a/python/tvm/topi/sparse/csrmm.py b/python/tvm/topi/sparse/csrmm.py index 954f9dd955f0..f578e6001351 100644 --- a/python/tvm/topi/sparse/csrmm.py +++ b/python/tvm/topi/sparse/csrmm.py @@ -19,7 +19,7 @@ import tvm from tvm import te from .. import tag -from ..util import simplify +from ..utils import simplify def csrmm_default(data, indices, indptr, weight, bias=None): diff --git a/python/tvm/topi/sparse/dense.py b/python/tvm/topi/sparse/dense.py index d86f5dd4bfce..d1516d0c20fc 100644 --- a/python/tvm/topi/sparse/dense.py +++ b/python/tvm/topi/sparse/dense.py @@ -19,7 +19,7 @@ import tvm from tvm import te from .. import tag -from ..util import simplify +from ..utils import simplify def dense_si(data, indices, indptr, weight, bias=None): diff --git a/python/tvm/topi/testing/bilinear_resize_python.py b/python/tvm/topi/testing/bilinear_resize_python.py index 8d78f13ddf76..844546e0643f 100644 --- a/python/tvm/topi/testing/bilinear_resize_python.py +++ b/python/tvm/topi/testing/bilinear_resize_python.py @@ -18,7 +18,7 @@ """Bilinear Scale in python""" import math import numpy as np -from tvm.topi.util import nchw_pack_layout +from tvm.topi.utils import nchw_pack_layout def bilinear_resize_python(image, out_size, layout, coordinate_transformation_mode="align_corners"): diff --git a/python/tvm/topi/testing/conv1d_ncw_python.py b/python/tvm/topi/testing/conv1d_ncw_python.py index 1405adb54f46..190e1c664610 100644 --- a/python/tvm/topi/testing/conv1d_ncw_python.py +++ b/python/tvm/topi/testing/conv1d_ncw_python.py @@ -17,7 +17,7 @@ # pylint: disable=unused-variable, invalid-name """1D convolution in python""" import numpy as np -from tvm.topi.nn.util import get_pad_tuple1d +from tvm.topi.nn.utils import get_pad_tuple1d def dilate_np(x, dilation): diff --git a/python/tvm/topi/testing/conv1d_transpose_ncw_python.py b/python/tvm/topi/testing/conv1d_transpose_ncw_python.py index 3a1bc61419ff..85e1410c0cd8 100644 --- a/python/tvm/topi/testing/conv1d_transpose_ncw_python.py +++ b/python/tvm/topi/testing/conv1d_transpose_ncw_python.py @@ -19,7 +19,7 @@ import numpy as np import scipy import tvm.topi.testing -from tvm.topi.nn.util import get_pad_tuple1d +from tvm.topi.nn.utils import get_pad_tuple1d def conv1d_transpose_ncw_python(a_np, w_np, stride, padding, output_padding): diff --git a/python/tvm/topi/testing/conv2d_hwcn_python.py b/python/tvm/topi/testing/conv2d_hwcn_python.py index 9a06edd82c3b..9ee66df51541 100644 --- a/python/tvm/topi/testing/conv2d_hwcn_python.py +++ b/python/tvm/topi/testing/conv2d_hwcn_python.py @@ -18,7 +18,7 @@ """Convolution in python""" import numpy as np import scipy.signal -from tvm.topi.nn.util import get_pad_tuple +from tvm.topi.nn.utils import get_pad_tuple def conv2d_hwcn_python(a_np, w_np, stride, padding): diff --git a/python/tvm/topi/testing/conv2d_nchw_python.py b/python/tvm/topi/testing/conv2d_nchw_python.py index 38bed4a00c49..ce5d981cc651 100644 --- a/python/tvm/topi/testing/conv2d_nchw_python.py +++ b/python/tvm/topi/testing/conv2d_nchw_python.py @@ -18,7 +18,7 @@ """Convolution in python""" import numpy as np import scipy.signal -from tvm.topi.nn.util import get_pad_tuple +from tvm.topi.nn.utils import get_pad_tuple def _conv2d_nchw_python(a_np, w_np, stride, padding): diff --git a/python/tvm/topi/testing/conv2d_nhwc_python.py b/python/tvm/topi/testing/conv2d_nhwc_python.py index 136fb6b8834a..68ef8c1b283e 100644 --- a/python/tvm/topi/testing/conv2d_nhwc_python.py +++ b/python/tvm/topi/testing/conv2d_nhwc_python.py @@ -18,7 +18,7 @@ """Convolution in python""" import numpy as np import scipy.signal -from tvm.topi.nn.util import get_pad_tuple +from tvm.topi.nn.utils import get_pad_tuple def _conv2d_nhwc_python(a_np, w_np, stride, padding): diff --git a/python/tvm/topi/testing/conv2d_transpose_python.py b/python/tvm/topi/testing/conv2d_transpose_python.py index 04e60a71dd60..c7c0d9f2529a 100644 --- a/python/tvm/topi/testing/conv2d_transpose_python.py +++ b/python/tvm/topi/testing/conv2d_transpose_python.py @@ -19,7 +19,7 @@ import numpy as np import scipy import tvm.topi.testing -from tvm.topi.nn.util import get_pad_tuple +from tvm.topi.nn.utils import get_pad_tuple def conv2d_transpose_nchw_python(a_np, w_np, stride, padding, output_padding): diff --git a/python/tvm/topi/testing/conv3d_ncdhw_python.py b/python/tvm/topi/testing/conv3d_ncdhw_python.py index 11b0e2351288..a10d9ed42d1c 100644 --- a/python/tvm/topi/testing/conv3d_ncdhw_python.py +++ b/python/tvm/topi/testing/conv3d_ncdhw_python.py @@ -18,7 +18,7 @@ """Convolution 3D in python""" import numpy as np import scipy.signal -from tvm.topi.nn.util import get_pad_tuple3d +from tvm.topi.nn.utils import get_pad_tuple3d def _conv3d_ncdhw_python(a_np, w_np, stride, padding): diff --git a/python/tvm/topi/testing/conv3d_ndhwc_python.py b/python/tvm/topi/testing/conv3d_ndhwc_python.py index 52974d488a71..46f04f630863 100644 --- a/python/tvm/topi/testing/conv3d_ndhwc_python.py +++ b/python/tvm/topi/testing/conv3d_ndhwc_python.py @@ -18,7 +18,7 @@ """Convolution 3D in python""" import numpy as np import scipy.signal -from tvm.topi.nn.util import get_pad_tuple3d +from tvm.topi.nn.utils import get_pad_tuple3d def conv3d_ndhwc_python(a_np, w_np, stride, padding): diff --git a/python/tvm/topi/testing/conv3d_transpose_ncdhw_python.py b/python/tvm/topi/testing/conv3d_transpose_ncdhw_python.py index 779371af9895..38b8bc51bc70 100644 --- a/python/tvm/topi/testing/conv3d_transpose_ncdhw_python.py +++ b/python/tvm/topi/testing/conv3d_transpose_ncdhw_python.py @@ -18,7 +18,7 @@ """Convolution 3D transpose in python""" import numpy as np import tvm.topi.testing -from tvm.topi.nn.util import get_pad_tuple3d +from tvm.topi.nn.utils import get_pad_tuple3d def conv3d_transpose_ncdhw_python(a_np, w_np, stride, padding, output_padding): diff --git a/python/tvm/topi/testing/deformable_conv2d_nchw_python.py b/python/tvm/topi/testing/deformable_conv2d_nchw_python.py index cc66c5f12906..6a7afb4b96f3 100644 --- a/python/tvm/topi/testing/deformable_conv2d_nchw_python.py +++ b/python/tvm/topi/testing/deformable_conv2d_nchw_python.py @@ -18,7 +18,7 @@ """Deformable convolution in python""" import itertools import numpy as np -from tvm.topi.nn.util import get_pad_tuple +from tvm.topi.nn.utils import get_pad_tuple def deformable_conv2d_nchw_python( diff --git a/python/tvm/topi/testing/upsampling_python.py b/python/tvm/topi/testing/upsampling_python.py index 203e804d3338..7f48aa47b8d1 100644 --- a/python/tvm/topi/testing/upsampling_python.py +++ b/python/tvm/topi/testing/upsampling_python.py @@ -18,7 +18,7 @@ """Upsampling in python""" import math import numpy as np -from tvm.topi.util import nchw_pack_layout +from tvm.topi.utils import nchw_pack_layout def upsample_nearest(arr, scale): diff --git a/python/tvm/topi/transform.py b/python/tvm/topi/transform.py index c4e51a8858d1..b4a7d1c414da 100644 --- a/python/tvm/topi/transform.py +++ b/python/tvm/topi/transform.py @@ -22,7 +22,7 @@ from tvm import topi from . import cpp from . import tag -from .util import within_index, make_idx +from .utils import within_index, make_idx def expand_dims(a, axis, num_newaxis=1): diff --git a/python/tvm/topi/util.py b/python/tvm/topi/utils.py similarity index 99% rename from python/tvm/topi/util.py rename to python/tvm/topi/utils.py index 0a5c93c632de..ea08f3a94fad 100644 --- a/python/tvm/topi/util.py +++ b/python/tvm/topi/utils.py @@ -450,4 +450,4 @@ def is_empty_shape(shape): is_empty: bool Whether input shape is empty or has dimesion with size 0. """ - return cpp.util.is_empty_shape(shape) + return cpp.utils.is_empty_shape(shape) diff --git a/python/tvm/topi/vision/rcnn/proposal.py b/python/tvm/topi/vision/rcnn/proposal.py index cda7522321fe..89726efd5d0e 100644 --- a/python/tvm/topi/vision/rcnn/proposal.py +++ b/python/tvm/topi/vision/rcnn/proposal.py @@ -19,7 +19,7 @@ import math import tvm from tvm import te -from ...util import get_const_tuple, get_const_int +from ...utils import get_const_tuple, get_const_int from ...sort import argsort diff --git a/python/tvm/topi/vision/rcnn/roi_align.py b/python/tvm/topi/vision/rcnn/roi_align.py index eafdc21089bd..a51ba33a6c45 100644 --- a/python/tvm/topi/vision/rcnn/roi_align.py +++ b/python/tvm/topi/vision/rcnn/roi_align.py @@ -18,8 +18,8 @@ """Roi align operator""" import tvm from tvm import te -from ...util import get_const_tuple -from ...cpp.util import bilinear_sample_nchw +from ...utils import get_const_tuple +from ...cpp.utils import bilinear_sample_nchw def roi_align_nchw(data, rois, pooled_size, spatial_scale, sample_ratio=-1): diff --git a/python/tvm/topi/vision/rcnn/roi_pool.py b/python/tvm/topi/vision/rcnn/roi_pool.py index 2254b74f4bdf..dd1429bcb3c5 100644 --- a/python/tvm/topi/vision/rcnn/roi_pool.py +++ b/python/tvm/topi/vision/rcnn/roi_pool.py @@ -18,7 +18,7 @@ """ROI pool operator""" import tvm from tvm import te -from ...util import get_const_tuple +from ...utils import get_const_tuple def roi_pool_nchw(data, rois, pooled_size, spatial_scale): diff --git a/python/tvm/topi/x86/batch_matmul.py b/python/tvm/topi/x86/batch_matmul.py index 100bdf205165..166c79a4c93b 100644 --- a/python/tvm/topi/x86/batch_matmul.py +++ b/python/tvm/topi/x86/batch_matmul.py @@ -21,7 +21,7 @@ from tvm.autotvm.task.space import SplitEntity from tvm.contrib import cblas, mkl from .. import generic -from ..util import traverse_inline, get_const_tuple, get_max_power2_factor +from ..utils import traverse_inline, get_const_tuple, get_max_power2_factor @autotvm.register_topi_compute("batch_matmul.x86") diff --git a/python/tvm/topi/x86/bitserial_conv2d.py b/python/tvm/topi/x86/bitserial_conv2d.py index 5fcc9e119c4e..18f305094754 100644 --- a/python/tvm/topi/x86/bitserial_conv2d.py +++ b/python/tvm/topi/x86/bitserial_conv2d.py @@ -20,9 +20,9 @@ from tvm import te from tvm import autotvm from .. import tag -from ..util import get_const_int, get_const_tuple +from ..utils import get_const_int, get_const_tuple from ..nn.pad import pad -from ..nn.util import get_pad_tuple +from ..nn.utils import get_pad_tuple from ..nn.bitserial_util import bitpack, binary_op_multiplier diff --git a/python/tvm/topi/x86/bitserial_dense.py b/python/tvm/topi/x86/bitserial_dense.py index e9546ac1ee2e..7af18f602234 100644 --- a/python/tvm/topi/x86/bitserial_dense.py +++ b/python/tvm/topi/x86/bitserial_dense.py @@ -20,7 +20,7 @@ import tvm from tvm import te from tvm import autotvm -from tvm.topi.util import get_const_int, get_const_tuple +from tvm.topi.utils import get_const_int, get_const_tuple from .. import tag from ..nn.bitserial_util import bitpack, binary_op_multiplier diff --git a/python/tvm/topi/x86/conv2d.py b/python/tvm/topi/x86/conv2d.py index a52e27a42755..7b9da8a90ede 100644 --- a/python/tvm/topi/x86/conv2d.py +++ b/python/tvm/topi/x86/conv2d.py @@ -27,8 +27,8 @@ from ..nn.conv2d import conv2d_infer_layout, _get_workload as _get_conv2d_workload from ..nn.conv2d import unpack_NCHWc_to_nchw from ..nn.depthwise_conv2d import _get_workload as _get_depthwise_conv2d_workload -from ..nn.util import get_pad_tuple -from ..util import get_const_tuple, traverse_inline +from ..nn.utils import get_pad_tuple +from ..utils import get_const_tuple, traverse_inline from . import conv2d_avx_1x1, conv2d_avx_common logger = logging.getLogger("topi") diff --git a/python/tvm/topi/x86/conv2d_alter_op.py b/python/tvm/topi/x86/conv2d_alter_op.py index 1c90841eb2de..db3c232b6a7f 100644 --- a/python/tvm/topi/x86/conv2d_alter_op.py +++ b/python/tvm/topi/x86/conv2d_alter_op.py @@ -26,9 +26,9 @@ from tvm import autotvm from .conv2d import _get_default_config from .conv2d_int8 import is_int8_hw_support, _get_default_config_int8 -from ..util import get_const_tuple +from ..utils import get_const_tuple from ..nn import conv2d_legalize, conv2d_alter_layout -from ..nn.util import get_pad_tuple +from ..nn.utils import get_pad_tuple logger = logging.getLogger("topi") diff --git a/python/tvm/topi/x86/conv2d_avx_1x1.py b/python/tvm/topi/x86/conv2d_avx_1x1.py index 8ca20be262bc..b4a966e1db13 100644 --- a/python/tvm/topi/x86/conv2d_avx_1x1.py +++ b/python/tvm/topi/x86/conv2d_avx_1x1.py @@ -22,11 +22,11 @@ from tvm.autotvm.task.space import SplitEntity, OtherOptionEntity from ..nn.pad import pad -from ..nn.util import get_pad_tuple +from ..nn.utils import get_pad_tuple from ..generic import conv2d as conv2d_generic -from ..util import get_const_tuple, simplify +from ..utils import get_const_tuple, simplify from .tensor_intrin import dot_16x1x16_uint8_int8_int32 -from .util import get_fp32_len +from .utils import get_fp32_len def _fallback_schedule(cfg, wkl): diff --git a/python/tvm/topi/x86/conv2d_avx_common.py b/python/tvm/topi/x86/conv2d_avx_common.py index 28a698c342d8..8d707445be05 100644 --- a/python/tvm/topi/x86/conv2d_avx_common.py +++ b/python/tvm/topi/x86/conv2d_avx_common.py @@ -20,9 +20,9 @@ from tvm.autotvm.task.space import SplitEntity, OtherOptionEntity from ..generic import conv2d as conv2d_generic -from ..util import get_const_tuple +from ..utils import get_const_tuple from .tensor_intrin import dot_16x1x16_uint8_int8_int32 -from .util import get_fp32_len +from .utils import get_fp32_len def _fallback_schedule(cfg, wkl): diff --git a/python/tvm/topi/x86/conv2d_int8.py b/python/tvm/topi/x86/conv2d_int8.py index e2862ec11ef7..905ada68f277 100644 --- a/python/tvm/topi/x86/conv2d_int8.py +++ b/python/tvm/topi/x86/conv2d_int8.py @@ -24,10 +24,10 @@ from ..nn.conv2d import _get_workload as _get_conv2d_workload from .. import tag from ..generic import conv2d as conv2d_generic -from ..nn.util import get_pad_tuple +from ..nn.utils import get_pad_tuple from ..nn.conv2d import unpack_NCHWc_to_nchw from ..nn.depthwise_conv2d import _get_workload as _get_depthwise_conv2d_workload -from ..util import get_const_tuple, traverse_inline +from ..utils import get_const_tuple, traverse_inline from .. import nn from . import conv2d_avx_1x1, conv2d_avx_common diff --git a/python/tvm/topi/x86/conv2d_transpose.py b/python/tvm/topi/x86/conv2d_transpose.py index 105c45526085..865b62bb3e87 100644 --- a/python/tvm/topi/x86/conv2d_transpose.py +++ b/python/tvm/topi/x86/conv2d_transpose.py @@ -17,7 +17,7 @@ # pylint: disable=invalid-name,unused-variable,unused-argument,no-member """Conv2D Transpose schedule on x86""" from tvm import te -from ..util import traverse_inline +from ..utils import traverse_inline from .. import nn from .conv2d import conv2d_nchw, schedule_conv2d_nchw diff --git a/python/tvm/topi/x86/conv3d.py b/python/tvm/topi/x86/conv3d.py index 479a27b296a4..cb202f5257af 100644 --- a/python/tvm/topi/x86/conv3d.py +++ b/python/tvm/topi/x86/conv3d.py @@ -22,11 +22,11 @@ from tvm import te from tvm import autotvm from tvm.autotvm.task.space import SplitEntity, OtherOptionEntity -from ..util import traverse_inline -from ..nn.util import get_pad_tuple3d, infer_pad3d +from ..utils import traverse_inline +from ..nn.utils import get_pad_tuple3d, infer_pad3d from ..nn.pad import pad -from ..util import get_const_tuple, simplify, get_const_int -from .util import get_fp32_len +from ..utils import get_const_tuple, simplify, get_const_int +from .utils import get_fp32_len Workload3D = namedtuple( "Workload", diff --git a/python/tvm/topi/x86/conv3d_transpose.py b/python/tvm/topi/x86/conv3d_transpose.py index f986ccfaa3d9..e743f02fb063 100644 --- a/python/tvm/topi/x86/conv3d_transpose.py +++ b/python/tvm/topi/x86/conv3d_transpose.py @@ -19,7 +19,7 @@ """Conv3D Transpose schedule on x86""" from tvm import te -from ..util import traverse_inline +from ..utils import traverse_inline from .. import nn from .conv3d import conv3d_ncdhw, schedule_conv3d_ncdhw diff --git a/python/tvm/topi/x86/dense.py b/python/tvm/topi/x86/dense.py index b0cc71acb232..15d7a1a310d6 100644 --- a/python/tvm/topi/x86/dense.py +++ b/python/tvm/topi/x86/dense.py @@ -25,9 +25,9 @@ from tvm.contrib import mkl from tvm.contrib import mkldnn -from .util import get_fp32_len +from .utils import get_fp32_len from .. import generic, tag -from ..util import traverse_inline, get_const_tuple +from ..utils import traverse_inline, get_const_tuple def _schedule_dense_pack_template(cfg, s, C): diff --git a/python/tvm/topi/x86/depthwise_conv2d.py b/python/tvm/topi/x86/depthwise_conv2d.py index 1921f7fecf29..badba1a248e9 100644 --- a/python/tvm/topi/x86/depthwise_conv2d.py +++ b/python/tvm/topi/x86/depthwise_conv2d.py @@ -22,12 +22,12 @@ from tvm import autotvm from tvm.autotvm.task.space import SplitEntity, OtherOptionEntity from ..nn.pad import pad -from ..util import get_const_tuple -from ..nn.util import get_pad_tuple +from ..utils import get_const_tuple +from ..nn.utils import get_pad_tuple from ..nn.depthwise_conv2d import _get_workload, depthwise_conv2d_infer_layout from ..nn.conv2d import unpack_NCHWc_to_nchw -from ..util import traverse_inline -from .util import get_fp32_len +from ..utils import traverse_inline +from .utils import get_fp32_len def _fallback_schedule(cfg, wkl): diff --git a/python/tvm/topi/x86/injective.py b/python/tvm/topi/x86/injective.py index a5e521b8eb20..29f903fd4e35 100644 --- a/python/tvm/topi/x86/injective.py +++ b/python/tvm/topi/x86/injective.py @@ -17,7 +17,7 @@ # pylint: disable=invalid-name """x86 declaration and schedules.""" from tvm import te -from ..util import is_empty_shape +from ..utils import is_empty_shape def schedule_injective_from_existing(sch, out): diff --git a/python/tvm/topi/x86/reduction.py b/python/tvm/topi/x86/reduction.py index 69659de7d8a9..db3ea81b7358 100644 --- a/python/tvm/topi/x86/reduction.py +++ b/python/tvm/topi/x86/reduction.py @@ -20,7 +20,7 @@ from tvm import te from .injective import schedule_injective_from_existing from .. import tag -from ..util import get_const_tuple +from ..utils import get_const_tuple def _schedule_reduce(sch, op, is_idx_reduce=False): diff --git a/python/tvm/topi/x86/roi_align.py b/python/tvm/topi/x86/roi_align.py index baa23ad2a135..ac2146b558f9 100644 --- a/python/tvm/topi/x86/roi_align.py +++ b/python/tvm/topi/x86/roi_align.py @@ -21,7 +21,7 @@ from tvm.te import hybrid from ..tensor import full -from ..util import get_const_tuple +from ..utils import get_const_tuple @hybrid.script diff --git a/python/tvm/topi/x86/sparse.py b/python/tvm/topi/x86/sparse.py index 8c4a387b8052..b6291083c8c1 100644 --- a/python/tvm/topi/x86/sparse.py +++ b/python/tvm/topi/x86/sparse.py @@ -18,8 +18,8 @@ """sparse_dense schedule on x86""" from tvm import te -from ..util import traverse_inline, get_const_int -from .util import get_fp32_len +from ..utils import traverse_inline, get_const_int +from .utils import get_fp32_len def schedule_sparse_dense(outs): diff --git a/python/tvm/topi/x86/util.py b/python/tvm/topi/x86/utils.py similarity index 100% rename from python/tvm/topi/x86/util.py rename to python/tvm/topi/x86/utils.py diff --git a/src/topi/schedule.cc b/src/topi/schedule.cc index 83457ced9f16..c315d40be277 100644 --- a/src/topi/schedule.cc +++ b/src/topi/schedule.cc @@ -182,11 +182,11 @@ TVM_REGISTER_GLOBAL("topi.cuda.schedule_lrn").set_body([](TVMArgs args, TVMRetVa }); /* Utility functions */ -TVM_REGISTER_GLOBAL("topi.util.is_empty_shape").set_body([](TVMArgs args, TVMRetValue* rv) { +TVM_REGISTER_GLOBAL("topi.utils.is_empty_shape").set_body([](TVMArgs args, TVMRetValue* rv) { *rv = topi::detail::is_empty_shape(args[0]); }); -TVM_REGISTER_GLOBAL("topi.util.bilinear_sample_nchw").set_body([](TVMArgs args, TVMRetValue* rv) { +TVM_REGISTER_GLOBAL("topi.utils.bilinear_sample_nchw").set_body([](TVMArgs args, TVMRetValue* rv) { *rv = detail::bilinear_sample_nchw(args[0], args[1], args[2], args[3]); }); diff --git a/tests/micro/qemu/test_zephyr.py b/tests/micro/qemu/test_zephyr.py index 67943ce2896f..a5fff781ddef 100644 --- a/tests/micro/qemu/test_zephyr.py +++ b/tests/micro/qemu/test_zephyr.py @@ -30,7 +30,7 @@ import tvm.relay from tvm.micro.contrib import zephyr -from tvm.contrib import util +from tvm.contrib import utils BUILD = True DEBUG = False @@ -93,7 +93,7 @@ def _make_session(mod): os.unlink(prev_build) session_kw["binary"].archive(prev_build, metadata_only=True) else: - unarchive_dir = util.tempdir() + unarchive_dir = utils.tempdir() session_kw["binary"] = tvm.micro.MicroBinary.unarchive( prev_build, unarchive_dir.relpath("binary") ) diff --git a/tests/micro/test_runtime_micro_on_arm.py b/tests/micro/test_runtime_micro_on_arm.py index cc4066d5adda..45ca8e74323c 100644 --- a/tests/micro/test_runtime_micro_on_arm.py +++ b/tests/micro/test_runtime_micro_on_arm.py @@ -19,7 +19,7 @@ import numpy as np import tvm from tvm import te -from tvm.contrib import graph_runtime, util +from tvm.contrib import graph_runtime, utils from tvm import relay import tvm.micro as micro from tvm.micro import create_micro_mod diff --git a/tests/python/all-platform-minimal-test/test_minimal_target_codegen_llvm.py b/tests/python/all-platform-minimal-test/test_minimal_target_codegen_llvm.py index 6c2897b1b561..9861a1c39740 100644 --- a/tests/python/all-platform-minimal-test/test_minimal_target_codegen_llvm.py +++ b/tests/python/all-platform-minimal-test/test_minimal_target_codegen_llvm.py @@ -20,7 +20,7 @@ import tvm.testing from tvm import te from tvm import topi -from tvm.contrib import util, clang +from tvm.contrib import utils, clang import numpy as np import ctypes import math @@ -86,7 +86,7 @@ def check_llvm(use_file): if not clang.find_clang(required=False): print("skip because clang is not available") return - temp = util.tempdir() + temp = utils.tempdir() ll_path = temp.relpath("temp.ll") ll_code = clang.create_llvm(cc_code, output=ll_path) s = te.create_schedule(B.op) diff --git a/tests/python/contrib/test_arm_compute_lib/infrastructure.py b/tests/python/contrib/test_arm_compute_lib/infrastructure.py index 42b111bcad2e..0e444809b014 100644 --- a/tests/python/contrib/test_arm_compute_lib/infrastructure.py +++ b/tests/python/contrib/test_arm_compute_lib/infrastructure.py @@ -26,7 +26,7 @@ from tvm import rpc from tvm.contrib import graph_runtime from tvm.relay.op.contrib import arm_compute_lib -from tvm.contrib import util +from tvm.contrib import utils from tvm.autotvm.measure import request_remote @@ -226,7 +226,7 @@ def build_and_run( def update_lib(lib, device, cross_compile): """Export the library to the remote/local device.""" lib_name = "mod.so" - temp = util.tempdir() + temp = utils.tempdir() lib_path = temp.relpath(lib_name) if cross_compile: lib.export_library(lib_path, cc=cross_compile) diff --git a/tests/python/contrib/test_binutil.py b/tests/python/contrib/test_binutils.py similarity index 96% rename from tests/python/contrib/test_binutil.py rename to tests/python/contrib/test_binutils.py index 83b220f03b10..f0aa2d157aed 100644 --- a/tests/python/contrib/test_binutil.py +++ b/tests/python/contrib/test_binutils.py @@ -26,9 +26,9 @@ import tvm from tvm import te import subprocess -from tvm.contrib import util +from tvm.contrib import utils from tvm.contrib import cc -from tvm.contrib.binutil import * +from tvm.contrib.binutils import * TOOLCHAIN_PREFIX = "" @@ -39,7 +39,7 @@ def make_binary(): int b = 5; \ return 0; \ }" - tmp_dir = util.tempdir() + tmp_dir = utils.tempdir() tmp_source = tmp_dir.relpath("source.c") tmp_obj = tmp_dir.relpath("obj.obj") with open(tmp_source, "w") as f: @@ -52,7 +52,7 @@ def make_binary(): def test_tvm_callback_get_section_size(binary=None): if binary is None: binary = make_binary() - tmp_dir = util.tempdir() + tmp_dir = utils.tempdir() tmp_bin = tmp_dir.relpath("obj.bin") with open(tmp_bin, "wb") as f: f.write(binary) @@ -76,7 +76,7 @@ def verify(): def test_tvm_callback_relocate_binary(): binary = make_binary() - tmp_dir = util.tempdir() + tmp_dir = utils.tempdir() tmp_bin = tmp_dir.relpath("obj.bin") with open(tmp_bin, "wb") as f: f.write(binary) @@ -133,7 +133,7 @@ def verify(): def test_tvm_callback_get_symbol_map(): binary = make_binary() - tmp_dir = util.tempdir() + tmp_dir = utils.tempdir() tmp_bin = tmp_dir.relpath("obj.bin") with open(tmp_bin, "wb") as f: f.write(binary) diff --git a/tests/python/contrib/test_coreml_runtime.py b/tests/python/contrib/test_coreml_runtime.py index f6b9d9eb58e4..c0076d6eb12f 100644 --- a/tests/python/contrib/test_coreml_runtime.py +++ b/tests/python/contrib/test_coreml_runtime.py @@ -18,7 +18,7 @@ from tvm import te import numpy as np from tvm import rpc -from tvm.contrib import util, xcode, coreml_runtime +from tvm.contrib import utils, xcode, coreml_runtime import pytest import os @@ -82,7 +82,7 @@ def verify(coreml_model, model_path, ctx): np.testing.assert_almost_equal(c_out, t_out, 3) def check_remote(coreml_model): - temp = util.tempdir() + temp = utils.tempdir() compiled_model = xcode.compile_coreml(coreml_model, out_dir=temp.temp_dir) xcode.popen_test_rpc( proxy_host, proxy_port, key, destination=destination, libs=[compiled_model] @@ -93,7 +93,7 @@ def check_remote(coreml_model): verify(coreml_model, compiled_model, ctx) def check_local(coreml_model): - temp = util.tempdir() + temp = utils.tempdir() compiled_model = xcode.compile_coreml(coreml_model, out_dir=temp.temp_dir) ctx = tvm.cpu(0) verify(coreml_model, compiled_model, ctx) diff --git a/tests/python/contrib/test_edgetpu_runtime.py b/tests/python/contrib/test_edgetpu_runtime.py index eef9e0b06349..8c6113cee3d4 100644 --- a/tests/python/contrib/test_edgetpu_runtime.py +++ b/tests/python/contrib/test_edgetpu_runtime.py @@ -19,7 +19,7 @@ from tvm import te import numpy as np from tvm import rpc -from tvm.contrib import util, tflite_runtime +from tvm.contrib import utils, tflite_runtime # import tflite_runtime.interpreter as tflite diff --git a/tests/python/contrib/test_ethosn/infrastructure.py b/tests/python/contrib/test_ethosn/infrastructure.py index 8f07a372ab6b..905d066ce7a3 100644 --- a/tests/python/contrib/test_ethosn/infrastructure.py +++ b/tests/python/contrib/test_ethosn/infrastructure.py @@ -20,7 +20,7 @@ from __future__ import absolute_import, print_function import tvm from tvm import relay -from tvm.contrib import util, graph_runtime, download +from tvm.contrib import utils, graph_runtime, download from hashlib import md5 from itertools import zip_longest, combinations import numpy as np @@ -61,7 +61,7 @@ def assert_lib_hash(lib, golden): if isinstance(golden, str): golden = {golden} - temp = util.tempdir() + temp = utils.tempdir() path = temp.relpath("lib.cmm") hash_set = set() for mod in lib.imported_modules: @@ -207,7 +207,7 @@ def run(lib, inputs, outputs, npu=True): """ # Export and load lib to confirm this works lib_name = "mod.so" - temp = util.tempdir() + temp = utils.tempdir() lib_path = temp.relpath(lib_name) lib.export_library(lib_path) lib = tvm.runtime.load_module(lib_path) diff --git a/tests/python/contrib/test_nnpack.py b/tests/python/contrib/test_nnpack.py index a92b9301f7cc..bcb4358596b2 100644 --- a/tests/python/contrib/test_nnpack.py +++ b/tests/python/contrib/test_nnpack.py @@ -19,7 +19,7 @@ from tvm import te import numpy as np import scipy.signal -from tvm.topi.nn.util import get_pad_tuple +from tvm.topi.nn.utils import get_pad_tuple from tvm.contrib import nnpack import pytest diff --git a/tests/python/contrib/test_tflite_runtime.py b/tests/python/contrib/test_tflite_runtime.py index c24747db8238..39d8881f4040 100644 --- a/tests/python/contrib/test_tflite_runtime.py +++ b/tests/python/contrib/test_tflite_runtime.py @@ -20,7 +20,7 @@ from tvm import te import numpy as np from tvm import rpc -from tvm.contrib import util, tflite_runtime +from tvm.contrib import utils, tflite_runtime def _create_tflite_model(): @@ -70,7 +70,7 @@ def test_local(): tflite_fname = "model.tflite" tflite_model = _create_tflite_model() - temp = util.tempdir() + temp = utils.tempdir() tflite_model_path = temp.relpath(tflite_fname) open(tflite_model_path, "wb").write(tflite_model) @@ -111,7 +111,7 @@ def test_remote(): tflite_fname = "model.tflite" tflite_model = _create_tflite_model() - temp = util.tempdir() + temp = utils.tempdir() tflite_model_path = temp.relpath(tflite_fname) open(tflite_model_path, "wb").write(tflite_model) diff --git a/tests/python/contrib/test_util.py b/tests/python/contrib/test_util.py index 29c6fbf6c897..5078450cedb9 100644 --- a/tests/python/contrib/test_util.py +++ b/tests/python/contrib/test_util.py @@ -19,7 +19,7 @@ import datetime import os import shutil -from tvm.contrib import util +from tvm.contrib import utils def validate_debug_dir_path(temp_dir, expected_basename): @@ -32,55 +32,55 @@ def validate_debug_dir_path(temp_dir, expected_basename): def test_tempdir(): - assert util.TempDirectory._KEEP_FOR_DEBUG == False, "don't submit with KEEP_FOR_DEBUG == True" + assert utils.TempDirectory._KEEP_FOR_DEBUG == False, "don't submit with KEEP_FOR_DEBUG == True" - temp_dir = util.tempdir() + temp_dir = utils.tempdir() assert os.path.exists(temp_dir.temp_dir) - old_debug_mode = util.TempDirectory._KEEP_FOR_DEBUG - old_tempdirs = util.TempDirectory.TEMPDIRS + old_debug_mode = utils.TempDirectory._KEEP_FOR_DEBUG + old_tempdirs = utils.TempDirectory.TEMPDIRS try: for temp_dir_number in range(0, 3): - with util.TempDirectory.set_keep_for_debug(): - debug_temp_dir = util.tempdir() + with utils.TempDirectory.set_keep_for_debug(): + debug_temp_dir = utils.tempdir() try: validate_debug_dir_path(debug_temp_dir, "0000" + str(temp_dir_number)) finally: shutil.rmtree(debug_temp_dir.temp_dir) - with util.TempDirectory.set_keep_for_debug(): + with utils.TempDirectory.set_keep_for_debug(): # Create 2 temp_dir within the same session. - debug_temp_dir = util.tempdir() + debug_temp_dir = utils.tempdir() try: validate_debug_dir_path(debug_temp_dir, "00003") finally: shutil.rmtree(debug_temp_dir.temp_dir) - debug_temp_dir = util.tempdir() + debug_temp_dir = utils.tempdir() try: validate_debug_dir_path(debug_temp_dir, "00004") finally: shutil.rmtree(debug_temp_dir.temp_dir) - with util.TempDirectory.set_keep_for_debug(False): - debug_temp_dir = util.tempdir() # This one should get deleted. + with utils.TempDirectory.set_keep_for_debug(False): + debug_temp_dir = utils.tempdir() # This one should get deleted. # Simulate atexit hook - util.TempDirectory.remove_tempdirs() + utils.TempDirectory.remove_tempdirs() # Calling twice should be a no-op. - util.TempDirectory.remove_tempdirs() + utils.TempDirectory.remove_tempdirs() # Creating a new TempDirectory should fail now try: - util.tempdir() + utils.tempdir() assert False, "creation should fail" - except util.DirectoryCreatedPastAtExit: + except utils.DirectoryCreatedPastAtExit: pass finally: - util.TempDirectory.DEBUG_MODE = old_debug_mode - util.TempDirectory.TEMPDIRS = old_tempdirs + utils.TempDirectory.DEBUG_MODE = old_debug_mode + utils.TempDirectory.TEMPDIRS = old_tempdirs if __name__ == "__main__": diff --git a/tests/python/frontend/caffe/test_forward.py b/tests/python/frontend/caffe/test_forward.py index 2005090d7b1a..d75ecd83a285 100644 --- a/tests/python/frontend/caffe/test_forward.py +++ b/tests/python/frontend/caffe/test_forward.py @@ -36,7 +36,7 @@ import tvm from tvm import relay -from tvm.contrib import util, graph_runtime +from tvm.contrib import utils, graph_runtime from tvm.contrib.download import download_testdata CURRENT_DIR = os.path.join(os.path.expanduser("~"), ".tvm_test_data", "caffe_test") diff --git a/tests/python/frontend/tensorflow/test_forward.py b/tests/python/frontend/tensorflow/test_forward.py index 0bcac7fb1a21..e8e38b86392c 100644 --- a/tests/python/frontend/tensorflow/test_forward.py +++ b/tests/python/frontend/tensorflow/test_forward.py @@ -2848,11 +2848,11 @@ def test_forward_inception_v1(): # Build an image from random data. from PIL import Image - from tvm.contrib import util + from tvm.contrib import utils img_array = np.random.uniform(size=(1, 600, 600, 3)).astype("uint8") img = Image.frombuffer("RGB", (600, 600), img_array.tostring(), "raw", "RGB", 0, 1) - temp = util.tempdir() + temp = utils.tempdir() img_path = temp.relpath("tf-test.jpg") img.save(img_path) diff --git a/tests/python/frontend/tflite/test_forward.py b/tests/python/frontend/tflite/test_forward.py index 3f860a3c6580..89ae34899331 100644 --- a/tests/python/frontend/tflite/test_forward.py +++ b/tests/python/frontend/tflite/test_forward.py @@ -3724,7 +3724,7 @@ def test_forward_qnn_coco_ssd_mobilenet_v1(): """Test the quantized Coco SSD Mobilenet V1 TF Lite model.""" pytest.skip( "LLVM bug - getExtendedVectorNumElements - " - + "https://discuss.tvm.ai/t/segfault-in-llvm/3567. The workaround is to use a " + + "https://discuss.tvm.apache.org/t/segfault-in-llvm/3567. The workaround is to use a " + "specific target, for example, llvm -mpcu=core-avx2" ) diff --git a/tests/python/integration/test_winograd_nnpack.py b/tests/python/integration/test_winograd_nnpack.py index f29d1fba8f1e..d32699375050 100644 --- a/tests/python/integration/test_winograd_nnpack.py +++ b/tests/python/integration/test_winograd_nnpack.py @@ -23,7 +23,7 @@ from tvm.contrib.pickle_memoize import memoize from tvm import topi import tvm.topi.testing -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple from pytest import skip import tvm.testing diff --git a/tests/python/relay/test_any.py b/tests/python/relay/test_any.py index d39e04ecd7c1..8784b97a31fa 100644 --- a/tests/python/relay/test_any.py +++ b/tests/python/relay/test_any.py @@ -22,7 +22,7 @@ from tvm import relay from tvm.relay.loops import while_loop from tvm.relay.testing import run_infer_type as infer_type -from util.assert_diagnostic import DiagnosticTesting +from utils.assert_diagnostic import DiagnosticTesting import tvm.topi.testing diff --git a/tests/python/relay/test_external_codegen.py b/tests/python/relay/test_external_codegen.py index c919e7ce1a7c..b2c4dd98721c 100644 --- a/tests/python/relay/test_external_codegen.py +++ b/tests/python/relay/test_external_codegen.py @@ -25,7 +25,7 @@ import tvm.relay.transform from tvm import relay from tvm import runtime -from tvm.contrib import util +from tvm.contrib import utils def check_result(mod, map_inputs, out_shape, result, tol=1e-5, target="llvm", ctx=tvm.cpu()): @@ -40,7 +40,7 @@ def update_lib(lib): kwargs = {} kwargs["options"] = ["-O2", "-std=c++14", "-I" + contrib_path] - tmp_path = util.tempdir() + tmp_path = utils.tempdir() lib_name = "lib.so" lib_path = tmp_path.relpath(lib_name) lib.export_library(lib_path, fcompile=False, **kwargs) diff --git a/tests/python/relay/test_json_runtime.py b/tests/python/relay/test_json_runtime.py index c09dab34be1e..df4dff81b03e 100644 --- a/tests/python/relay/test_json_runtime.py +++ b/tests/python/relay/test_json_runtime.py @@ -24,7 +24,7 @@ import tvm.relay.op as reg import tvm.relay.testing from tvm import relay, runtime -from tvm.contrib import util +from tvm.contrib import utils from tvm.relay import transform from tvm.relay.backend import compile_engine from tvm.relay.build_module import bind_params_by_name diff --git a/tests/python/relay/test_op_grad_level2.py b/tests/python/relay/test_op_grad_level2.py index 85332da64221..80a567d9cb65 100644 --- a/tests/python/relay/test_op_grad_level2.py +++ b/tests/python/relay/test_op_grad_level2.py @@ -38,7 +38,7 @@ def verify_max_pool2d_grad(x_shape, pool_size, strides, padding, ceil_mode): data = np.random.rand(*x_shape).astype("float32") ph, pw = padding - y_shape = topi.util.get_const_tuple(fwd_func.ret_type.shape) + y_shape = topi.utils.get_const_tuple(fwd_func.ret_type.shape) out_grad = np.ones(shape=y_shape) ref_grad = tvm.topi.testing.pool_grad_nchw( data, @@ -87,7 +87,7 @@ def verify_avg_pool2d_grad( data = np.random.rand(*x_shape).astype(dtype) ph, pw = padding - y_shape = topi.util.get_const_tuple(fwd_func.ret_type.shape) + y_shape = topi.utils.get_const_tuple(fwd_func.ret_type.shape) out_grad = np.ones(shape=y_shape) ref_grad = tvm.topi.testing.pool_grad_nchw( data, @@ -143,7 +143,7 @@ def verify_global_avg_pool2d_grad(x_shape): bwd_func = run_infer_type(gradient(fwd_func)) data = np.random.rand(*x_shape).astype("float32") - y_shape = topi.util.get_const_tuple(fwd_func.ret_type.shape) + y_shape = topi.utils.get_const_tuple(fwd_func.ret_type.shape) out_grad = np.ones(shape=y_shape) ref_grad = tvm.topi.testing.pool_grad_nchw( data, diff --git a/tests/python/relay/test_op_level2.py b/tests/python/relay/test_op_level2.py index 546ea6019e56..a2b791d8d33f 100644 --- a/tests/python/relay/test_op_level2.py +++ b/tests/python/relay/test_op_level2.py @@ -23,7 +23,7 @@ from tvm import relay from tvm.relay import transform from tvm.relay.testing import run_infer_type -from tvm.contrib import util +from tvm.contrib import utils import tvm.topi.testing from tvm.topi.cuda.conv3d_winograd import _infer_tile_size import tvm.testing @@ -258,7 +258,7 @@ def compile_test_conv2d_arm_cpu( ["data_pad_inline", "ot", 4], ["data_vec_inline", "ot", 1], \ ["conv_inline", "ot", 0]]}], "r": [[0.0002933163], \ 0, 3.1976189613342285, 1570811630.6058347], "v": 0.1}' - temp = util.tempdir() + temp = utils.tempdir() with open(temp.relpath("temp.log"), "w") as log_file: log_file.write(test_schedule) with autotvm.apply_history_best(temp.relpath("temp.log")): diff --git a/tests/python/relay/test_op_qnn_conv2d.py b/tests/python/relay/test_op_qnn_conv2d.py index e14bba2d7f78..67d4c6f0b807 100644 --- a/tests/python/relay/test_op_qnn_conv2d.py +++ b/tests/python/relay/test_op_qnn_conv2d.py @@ -176,7 +176,7 @@ def get_funcs( def verify(ref_func, qnn_func, data_shape, data_dtype, kernel_shape, kernel_dtype): def get_inputs(data_shape, data_dtype, kernel_shape, kernel_dtype): # Keeping inputs multiple of 4 because of a bug in Average Pool2d - # https://discuss.tvm.ai/t/pool2d-gives-bad-output-for-integer-inputs/3377 + # https://discuss.tvm.apache.org/t/pool2d-gives-bad-output-for-integer-inputs/3377 low = -128 high = 127 if data_dtype == "uint8": diff --git a/tests/python/relay/test_param_dict.py b/tests/python/relay/test_param_dict.py index 68e4b5028c06..74c9ebcaa355 100644 --- a/tests/python/relay/test_param_dict.py +++ b/tests/python/relay/test_param_dict.py @@ -24,7 +24,7 @@ from tvm.relay.op import add from tvm import relay from tvm import rpc -from tvm.contrib import util, graph_runtime +from tvm.contrib import utils, graph_runtime def test_save_load(): @@ -70,7 +70,7 @@ def verify_graph_runtime(remote, target, shape, dtype): params = {"x": x_in} graph, lib, params = relay.build(func, target=target, params=params) - temp = util.tempdir() + temp = utils.tempdir() path_dso = temp.relpath("dev_lib.o") lib.save(path_dso) remote.upload(path_dso) diff --git a/tests/python/relay/test_pass_annotate_target.py b/tests/python/relay/test_pass_annotate_target.py index 30b35fb8044b..b99e3bc02ba4 100644 --- a/tests/python/relay/test_pass_annotate_target.py +++ b/tests/python/relay/test_pass_annotate_target.py @@ -25,7 +25,7 @@ import tvm.relay.transform as transform from tvm import relay from tvm import runtime -from tvm.contrib import util +from tvm.contrib import utils def check_result( @@ -42,7 +42,7 @@ def update_lib(lib): kwargs = {} kwargs["options"] = ["-O2", "-std=c++14", "-I" + contrib_path] - tmp_path = util.tempdir() + tmp_path = utils.tempdir() lib_name = "lib.so" lib_path = tmp_path.relpath(lib_name) lib.export_library(lib_path, fcompile=False, **kwargs) diff --git a/tests/python/relay/test_pass_auto_quantize.py b/tests/python/relay/test_pass_auto_quantize.py index 034cb48de186..8a7c4cbfbbd6 100644 --- a/tests/python/relay/test_pass_auto_quantize.py +++ b/tests/python/relay/test_pass_auto_quantize.py @@ -22,7 +22,7 @@ from tvm import relay from tvm.relay import testing from tvm.relay.expr import Call -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple def quantize_and_build(out): diff --git a/tests/python/relay/test_pass_merge_compiler_regions.py b/tests/python/relay/test_pass_merge_compiler_regions.py index 8447eeffa6ba..ba94021d3f66 100644 --- a/tests/python/relay/test_pass_merge_compiler_regions.py +++ b/tests/python/relay/test_pass_merge_compiler_regions.py @@ -89,7 +89,7 @@ def expected(): def test_example_graph(): """This tests the merging algorithm on the example used in the RFC. - See the RFC here: https://discuss.tvm.ai/t/relay-improved-graph-partitioning-algorithm/5830 + See the RFC here: https://discuss.tvm.apache.org/t/relay-improved-graph-partitioning-algorithm/5830 Blue nodes are adds (target: test), red nodes are subtracts (target: default). """ diff --git a/tests/python/relay/test_pass_partition_graph.py b/tests/python/relay/test_pass_partition_graph.py index 2fd440e1c2c9..8d0e2d5e22e0 100644 --- a/tests/python/relay/test_pass_partition_graph.py +++ b/tests/python/relay/test_pass_partition_graph.py @@ -27,7 +27,7 @@ from tvm import relay from tvm import runtime from tvm.relay import transform -from tvm.contrib import util +from tvm.contrib import utils from tvm.relay.backend import compile_engine from tvm.relay.expr_functor import ExprMutator from tvm.relay.op.annotation import compiler_begin, compiler_end @@ -186,7 +186,7 @@ def update_lib(lib): kwargs = {} kwargs["options"] = ["-O2", "-std=c++14", "-I" + contrib_path] - tmp_path = util.tempdir() + tmp_path = utils.tempdir() lib_name = "lib.so" lib_path = tmp_path.relpath(lib_name) lib.export_library(lib_path, fcompile=False, **kwargs) diff --git a/tests/python/relay/test_vm_serialization.py b/tests/python/relay/test_vm_serialization.py index 14f003e3500b..b2a695dc5434 100644 --- a/tests/python/relay/test_vm_serialization.py +++ b/tests/python/relay/test_vm_serialization.py @@ -27,7 +27,7 @@ from tvm.relay.scope_builder import ScopeBuilder from tvm.relay import transform from tvm.relay.prelude import Prelude -from tvm.contrib import util +from tvm.contrib import utils from tvm.relay import testing @@ -129,7 +129,7 @@ def test_save_load(): assert isinstance(code, bytearray) # save and load the code and lib file. - tmp = util.tempdir() + tmp = utils.tempdir() path_lib = tmp.relpath("lib.so") lib.export_library(path_lib) with open(tmp.relpath("code.ro"), "wb") as fo: diff --git a/tests/python/relay/util/assert_diagnostic.py b/tests/python/relay/utils/assert_diagnostic.py similarity index 100% rename from tests/python/relay/util/assert_diagnostic.py rename to tests/python/relay/utils/assert_diagnostic.py diff --git a/tests/python/topi/python/test_topi_basic.py b/tests/python/topi/python/test_topi_basic.py index 074319895bcb..108b92d903d9 100644 --- a/tests/python/topi/python/test_topi_basic.py +++ b/tests/python/topi/python/test_topi_basic.py @@ -17,13 +17,13 @@ import tvm from tvm import te from tvm import topi -from tvm.topi import util +from tvm.topi import utils def test_util(): x = tvm.tir.const(100, "int32") - assert util.get_const_int(x) == 100 - assert util.get_const_tuple((x, x)) == (100, 100) + assert utils.get_const_int(x) == 100 + assert utils.get_const_tuple((x, x)) == (100, 100) def test_ewise(): diff --git a/tests/python/topi/python/test_topi_batch_matmul.py b/tests/python/topi/python/test_topi_batch_matmul.py index 0d82ee69fa26..e939f6c21e37 100644 --- a/tests/python/topi/python/test_topi_batch_matmul.py +++ b/tests/python/topi/python/test_topi_batch_matmul.py @@ -20,7 +20,7 @@ from tvm import te from tvm import topi import tvm.topi.testing -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple from tvm.contrib.pickle_memoize import memoize import tvm.testing diff --git a/tests/python/topi/python/test_topi_bitserial_conv2d.py b/tests/python/topi/python/test_topi_bitserial_conv2d.py index 8e55c7bd4306..b0bce44a03f9 100644 --- a/tests/python/topi/python/test_topi_bitserial_conv2d.py +++ b/tests/python/topi/python/test_topi_bitserial_conv2d.py @@ -20,7 +20,7 @@ from tvm import topi import tvm.testing import tvm.topi.testing -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple from tvm.contrib.pickle_memoize import memoize diff --git a/tests/python/topi/python/test_topi_bitserial_conv2d_rasp.py b/tests/python/topi/python/test_topi_bitserial_conv2d_rasp.py index 76f342255541..1cd982db5450 100644 --- a/tests/python/topi/python/test_topi_bitserial_conv2d_rasp.py +++ b/tests/python/topi/python/test_topi_bitserial_conv2d_rasp.py @@ -21,7 +21,7 @@ from tvm import te from tvm import topi import tvm.topi.testing -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple def generate_quantized_np(shape, bits, out_dtype): diff --git a/tests/python/topi/python/test_topi_bitserial_dense.py b/tests/python/topi/python/test_topi_bitserial_dense.py index 8b565ac52da5..a624b1b1fede 100644 --- a/tests/python/topi/python/test_topi_bitserial_dense.py +++ b/tests/python/topi/python/test_topi_bitserial_dense.py @@ -22,7 +22,7 @@ from tvm import topi import tvm.testing import tvm.topi.testing -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple from tvm.contrib.pickle_memoize import memoize _bitserial_dense_implement = { diff --git a/tests/python/topi/python/test_topi_bnn.py b/tests/python/topi/python/test_topi_bnn.py index 1bec2d0507cf..fbd9ac5d66c6 100644 --- a/tests/python/topi/python/test_topi_bnn.py +++ b/tests/python/topi/python/test_topi_bnn.py @@ -20,7 +20,7 @@ import tvm.testing from tvm import te from tvm import topi -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple from tvm.contrib.pickle_memoize import memoize diff --git a/tests/python/topi/python/test_topi_clip.py b/tests/python/topi/python/test_topi_clip.py index bee31a50a209..704ffe7e6843 100644 --- a/tests/python/topi/python/test_topi_clip.py +++ b/tests/python/topi/python/test_topi_clip.py @@ -21,7 +21,7 @@ from tvm import topi import tvm.testing import tvm.topi.testing -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple from tvm.contrib.pickle_memoize import memoize diff --git a/tests/python/topi/python/test_topi_conv1d.py b/tests/python/topi/python/test_topi_conv1d.py index 533910308ce8..aad029ce3ce5 100644 --- a/tests/python/topi/python/test_topi_conv1d.py +++ b/tests/python/topi/python/test_topi_conv1d.py @@ -23,7 +23,7 @@ import tvm.testing import tvm.topi.testing from tvm.contrib.pickle_memoize import memoize -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple _conv1d_ncw_implement = { diff --git a/tests/python/topi/python/test_topi_conv1d_transpose_ncw.py b/tests/python/topi/python/test_topi_conv1d_transpose_ncw.py index 5b02d586a801..c251283f8011 100644 --- a/tests/python/topi/python/test_topi_conv1d_transpose_ncw.py +++ b/tests/python/topi/python/test_topi_conv1d_transpose_ncw.py @@ -22,7 +22,7 @@ from tvm import topi import tvm.topi.testing from tvm.contrib.pickle_memoize import memoize -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple import tvm.testing _conv1d_transpose_ncw_implement = { diff --git a/tests/python/topi/python/test_topi_conv2d_NCHWc.py b/tests/python/topi/python/test_topi_conv2d_NCHWc.py index a21790d61861..b1955ef5fa3b 100644 --- a/tests/python/topi/python/test_topi_conv2d_NCHWc.py +++ b/tests/python/topi/python/test_topi_conv2d_NCHWc.py @@ -24,8 +24,8 @@ import tvm.testing import tvm.topi.testing from tvm.contrib.pickle_memoize import memoize -from tvm.topi.nn.util import get_pad_tuple -from tvm.topi.util import get_const_tuple +from tvm.topi.nn.utils import get_pad_tuple +from tvm.topi.utils import get_const_tuple def _transform_data(data, bn): diff --git a/tests/python/topi/python/test_topi_conv2d_hwcn.py b/tests/python/topi/python/test_topi_conv2d_hwcn.py index a16499ace46d..bd88839c9c15 100644 --- a/tests/python/topi/python/test_topi_conv2d_hwcn.py +++ b/tests/python/topi/python/test_topi_conv2d_hwcn.py @@ -22,7 +22,7 @@ from tvm import topi import tvm.topi.testing from tvm.contrib.pickle_memoize import memoize -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple import tvm.testing diff --git a/tests/python/topi/python/test_topi_conv2d_hwnc_tensorcore.py b/tests/python/topi/python/test_topi_conv2d_hwnc_tensorcore.py index 758976469bfd..9d63175d2e84 100644 --- a/tests/python/topi/python/test_topi_conv2d_hwnc_tensorcore.py +++ b/tests/python/topi/python/test_topi_conv2d_hwnc_tensorcore.py @@ -25,8 +25,8 @@ from tvm import te, autotvm, topi from tvm.contrib.pickle_memoize import memoize from tvm.contrib import nvcc -from tvm.topi.nn.util import get_pad_tuple -from tvm.topi.util import get_const_tuple +from tvm.topi.nn.utils import get_pad_tuple +from tvm.topi.utils import get_const_tuple _conv2d_hwnc_tensorcore_implement = { "cuda": (topi.cuda.conv2d_hwnc_tensorcore, topi.cuda.schedule_conv2d_hwnc_tensorcore) diff --git a/tests/python/topi/python/test_topi_conv2d_int8.py b/tests/python/topi/python/test_topi_conv2d_int8.py index b2f9835c3d66..e5b0689da008 100644 --- a/tests/python/topi/python/test_topi_conv2d_int8.py +++ b/tests/python/topi/python/test_topi_conv2d_int8.py @@ -24,8 +24,8 @@ from tvm import topi import tvm.topi.testing from tvm.contrib.pickle_memoize import memoize -from tvm.topi.nn.util import get_pad_tuple -from tvm.topi.util import get_const_tuple +from tvm.topi.nn.utils import get_pad_tuple +from tvm.topi.utils import get_const_tuple from tvm.topi.arm_cpu.conv2d_gemm import is_aarch64_arm from common import Int8Fallback diff --git a/tests/python/topi/python/test_topi_conv2d_nchw.py b/tests/python/topi/python/test_topi_conv2d_nchw.py index fef46e371da7..1b7575211dac 100644 --- a/tests/python/topi/python/test_topi_conv2d_nchw.py +++ b/tests/python/topi/python/test_topi_conv2d_nchw.py @@ -23,8 +23,8 @@ from tvm import topi import tvm.topi.testing from tvm.contrib.pickle_memoize import memoize -from tvm.topi.nn.util import get_pad_tuple -from tvm.topi.util import get_const_tuple +from tvm.topi.nn.utils import get_pad_tuple +from tvm.topi.utils import get_const_tuple import tvm.testing diff --git a/tests/python/topi/python/test_topi_conv2d_nhwc.py b/tests/python/topi/python/test_topi_conv2d_nhwc.py index 747bd4f4429b..8c3b9e931eea 100644 --- a/tests/python/topi/python/test_topi_conv2d_nhwc.py +++ b/tests/python/topi/python/test_topi_conv2d_nhwc.py @@ -22,7 +22,7 @@ from tvm import topi import tvm.topi.testing from tvm.contrib.pickle_memoize import memoize -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple import tvm.testing diff --git a/tests/python/topi/python/test_topi_conv2d_nhwc_pack_int8.py b/tests/python/topi/python/test_topi_conv2d_nhwc_pack_int8.py index f6617379b549..c547ec7d0272 100644 --- a/tests/python/topi/python/test_topi_conv2d_nhwc_pack_int8.py +++ b/tests/python/topi/python/test_topi_conv2d_nhwc_pack_int8.py @@ -25,7 +25,7 @@ from tvm import topi import tvm.topi.testing from tvm.contrib.pickle_memoize import memoize -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple def verify_conv2d_1x1_nhwc_pack_int8( diff --git a/tests/python/topi/python/test_topi_conv2d_nhwc_tensorcore.py b/tests/python/topi/python/test_topi_conv2d_nhwc_tensorcore.py index 8d881b01250c..eab73410dbe6 100644 --- a/tests/python/topi/python/test_topi_conv2d_nhwc_tensorcore.py +++ b/tests/python/topi/python/test_topi_conv2d_nhwc_tensorcore.py @@ -24,8 +24,8 @@ from tvm import te from tvm.contrib.pickle_memoize import memoize from tvm.contrib import nvcc -from tvm.topi.nn.util import get_pad_tuple -from tvm.topi.util import get_const_tuple +from tvm.topi.nn.utils import get_pad_tuple +from tvm.topi.utils import get_const_tuple import tvm.testing diff --git a/tests/python/topi/python/test_topi_conv2d_nhwc_winograd.py b/tests/python/topi/python/test_topi_conv2d_nhwc_winograd.py index 3ffa4ac21f15..ac29fd6d0cff 100644 --- a/tests/python/topi/python/test_topi_conv2d_nhwc_winograd.py +++ b/tests/python/topi/python/test_topi_conv2d_nhwc_winograd.py @@ -24,8 +24,8 @@ import tvm.topi.testing from tvm import te from tvm.contrib.pickle_memoize import memoize -from tvm.topi.nn.util import get_pad_tuple -from tvm.topi.util import get_const_tuple +from tvm.topi.nn.utils import get_pad_tuple +from tvm.topi.utils import get_const_tuple import tvm.testing diff --git a/tests/python/topi/python/test_topi_conv2d_transpose_nchw.py b/tests/python/topi/python/test_topi_conv2d_transpose_nchw.py index 267cfbe4c990..5cc2c2eb6f5d 100644 --- a/tests/python/topi/python/test_topi_conv2d_transpose_nchw.py +++ b/tests/python/topi/python/test_topi_conv2d_transpose_nchw.py @@ -21,7 +21,7 @@ from tvm import topi import tvm.topi.testing from tvm.contrib.pickle_memoize import memoize -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple import tvm.testing diff --git a/tests/python/topi/python/test_topi_conv2d_winograd.py b/tests/python/topi/python/test_topi_conv2d_winograd.py index 69ef4f78723a..9f07dbd1be46 100644 --- a/tests/python/topi/python/test_topi_conv2d_winograd.py +++ b/tests/python/topi/python/test_topi_conv2d_winograd.py @@ -24,8 +24,8 @@ from tvm import topi import tvm.topi.testing from tvm.contrib.pickle_memoize import memoize -from tvm.topi.nn.util import get_pad_tuple -from tvm.topi.util import get_const_tuple +from tvm.topi.nn.utils import get_pad_tuple +from tvm.topi.utils import get_const_tuple import tvm.testing diff --git a/tests/python/topi/python/test_topi_conv3d_ncdhw.py b/tests/python/topi/python/test_topi_conv3d_ncdhw.py index 58f30fbf6003..094a71074fa0 100644 --- a/tests/python/topi/python/test_topi_conv3d_ncdhw.py +++ b/tests/python/topi/python/test_topi_conv3d_ncdhw.py @@ -24,8 +24,8 @@ import tvm.testing import tvm.topi.testing from tvm.contrib.pickle_memoize import memoize -from tvm.topi.nn.util import get_pad_tuple3d -from tvm.topi.util import get_const_tuple +from tvm.topi.nn.utils import get_pad_tuple3d +from tvm.topi.utils import get_const_tuple _conv3d_ncdhw_implement = { "generic": (topi.nn.conv3d_ncdhw, topi.generic.schedule_conv3d_ncdhw), diff --git a/tests/python/topi/python/test_topi_conv3d_ndhwc.py b/tests/python/topi/python/test_topi_conv3d_ndhwc.py index 2baacc07de75..2d2541af5979 100644 --- a/tests/python/topi/python/test_topi_conv3d_ndhwc.py +++ b/tests/python/topi/python/test_topi_conv3d_ndhwc.py @@ -23,7 +23,7 @@ import tvm.testing import tvm.topi.testing from tvm.contrib.pickle_memoize import memoize -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple _conv3d_ndhwc_implement = { diff --git a/tests/python/topi/python/test_topi_conv3d_ndhwc_tensorcore.py b/tests/python/topi/python/test_topi_conv3d_ndhwc_tensorcore.py index 9a7d99ae6893..1e027aba4cd3 100644 --- a/tests/python/topi/python/test_topi_conv3d_ndhwc_tensorcore.py +++ b/tests/python/topi/python/test_topi_conv3d_ndhwc_tensorcore.py @@ -24,8 +24,8 @@ from tvm import te from tvm.contrib.pickle_memoize import memoize from tvm.contrib import nvcc -from tvm.topi.nn.util import get_pad_tuple3d -from tvm.topi.util import get_const_tuple +from tvm.topi.nn.utils import get_pad_tuple3d +from tvm.topi.utils import get_const_tuple import tvm.testing diff --git a/tests/python/topi/python/test_topi_conv3d_transpose_ncdhw.py b/tests/python/topi/python/test_topi_conv3d_transpose_ncdhw.py index 480ec193ccf4..2ac7ccc708ec 100644 --- a/tests/python/topi/python/test_topi_conv3d_transpose_ncdhw.py +++ b/tests/python/topi/python/test_topi_conv3d_transpose_ncdhw.py @@ -22,7 +22,7 @@ import tvm.testing import tvm.topi.testing from tvm.contrib.pickle_memoize import memoize -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple _conv3d_transpose_ncdhw_implement = { diff --git a/tests/python/topi/python/test_topi_conv3d_winograd.py b/tests/python/topi/python/test_topi_conv3d_winograd.py index fbb2995603c4..d00249ba4392 100644 --- a/tests/python/topi/python/test_topi_conv3d_winograd.py +++ b/tests/python/topi/python/test_topi_conv3d_winograd.py @@ -24,8 +24,8 @@ import tvm.testing import tvm.topi.testing from tvm.contrib.pickle_memoize import memoize -from tvm.topi.nn.util import get_pad_tuple3d -from tvm.topi.util import get_const_tuple +from tvm.topi.nn.utils import get_pad_tuple3d +from tvm.topi.utils import get_const_tuple _conv3d_ncdhw_implement = { diff --git a/tests/python/topi/python/test_topi_correlation.py b/tests/python/topi/python/test_topi_correlation.py index 17c21d6cb3f9..4709fb7d68f9 100644 --- a/tests/python/topi/python/test_topi_correlation.py +++ b/tests/python/topi/python/test_topi_correlation.py @@ -23,7 +23,7 @@ import tvm.testing import tvm.topi.testing from tvm.contrib.pickle_memoize import memoize -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple _correlation_implement = { "generic": (topi.nn.correlation_nchw, topi.generic.schedule_correlation_nchw), diff --git a/tests/python/topi/python/test_topi_deformable_conv2d.py b/tests/python/topi/python/test_topi_deformable_conv2d.py index f57f42139395..34bfae7bad68 100644 --- a/tests/python/topi/python/test_topi_deformable_conv2d.py +++ b/tests/python/topi/python/test_topi_deformable_conv2d.py @@ -21,7 +21,7 @@ from tvm import topi import tvm.topi.testing from tvm.contrib.pickle_memoize import memoize -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple import tvm.testing diff --git a/tests/python/topi/python/test_topi_dense.py b/tests/python/topi/python/test_topi_dense.py index f46a271ced53..95ebce43497b 100644 --- a/tests/python/topi/python/test_topi_dense.py +++ b/tests/python/topi/python/test_topi_dense.py @@ -20,7 +20,7 @@ from tvm import te from tvm import topi import tvm.topi.testing -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple from tvm.contrib.pickle_memoize import memoize from common import Int8Fallback diff --git a/tests/python/topi/python/test_topi_dense_tensorcore.py b/tests/python/topi/python/test_topi_dense_tensorcore.py index 07dab352da86..3ffdea50d660 100644 --- a/tests/python/topi/python/test_topi_dense_tensorcore.py +++ b/tests/python/topi/python/test_topi_dense_tensorcore.py @@ -20,7 +20,7 @@ import tvm from tvm import topi import tvm.topi.testing -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple from tvm import te from tvm.contrib.pickle_memoize import memoize import tvm.testing diff --git a/tests/python/topi/python/test_topi_depthwise_conv2d.py b/tests/python/topi/python/test_topi_depthwise_conv2d.py index 07ddeab2e897..d5fbef98593c 100644 --- a/tests/python/topi/python/test_topi_depthwise_conv2d.py +++ b/tests/python/topi/python/test_topi_depthwise_conv2d.py @@ -20,8 +20,8 @@ from tvm import topi import tvm.topi.testing import numpy as np -from tvm.topi.util import get_const_tuple -from tvm.topi.nn.util import get_pad_tuple +from tvm.topi.utils import get_const_tuple +from tvm.topi.nn.utils import get_pad_tuple from tvm.contrib.pickle_memoize import memoize import tvm.testing diff --git a/tests/python/topi/python/test_topi_depthwise_conv2d_back_input.py b/tests/python/topi/python/test_topi_depthwise_conv2d_back_input.py index 8b4575fa396d..72ad1e29004a 100644 --- a/tests/python/topi/python/test_topi_depthwise_conv2d_back_input.py +++ b/tests/python/topi/python/test_topi_depthwise_conv2d_back_input.py @@ -20,8 +20,8 @@ import numpy as np from tvm.contrib.pickle_memoize import memoize from scipy import signal -from tvm.topi.util import get_const_tuple -from tvm.topi.nn.util import get_pad_tuple +from tvm.topi.utils import get_const_tuple +from tvm.topi.nn.utils import get_pad_tuple import tvm.topi.testing from tvm.topi.cuda.depthwise_conv2d import schedule_depthwise_conv2d_backward_input_nhwc import tvm.testing diff --git a/tests/python/topi/python/test_topi_depthwise_conv2d_back_weight.py b/tests/python/topi/python/test_topi_depthwise_conv2d_back_weight.py index 3826f6f1f473..53328113aa71 100644 --- a/tests/python/topi/python/test_topi_depthwise_conv2d_back_weight.py +++ b/tests/python/topi/python/test_topi_depthwise_conv2d_back_weight.py @@ -21,8 +21,8 @@ import numpy as np from tvm.contrib.pickle_memoize import memoize from scipy import signal -from tvm.topi.util import get_const_tuple -from tvm.topi.nn.util import get_pad_tuple +from tvm.topi.utils import get_const_tuple +from tvm.topi.nn.utils import get_pad_tuple from tvm.topi.cuda.depthwise_conv2d import schedule_depthwise_conv2d_backward_weight_nhwc import tvm.testing diff --git a/tests/python/topi/python/test_topi_dilate.py b/tests/python/topi/python/test_topi_dilate.py index 0ee51a6c7bf4..27e71735c565 100644 --- a/tests/python/topi/python/test_topi_dilate.py +++ b/tests/python/topi/python/test_topi_dilate.py @@ -39,7 +39,7 @@ def _test_dilate(input_size, strides, dilation_value=None): else: output_np = tvm.topi.testing.dilate_python(input_np, strides, dilation_value) input_tvm = tvm.nd.array(input_np, ctx=ctx) - output_size = topi.util.get_const_tuple(Output.shape) + output_size = topi.utils.get_const_tuple(Output.shape) output_tvm = tvm.nd.array(np.zeros(shape=output_size).astype(Output.dtype), ctx=ctx) f = tvm.build(schedule, [Input, Output], target) f(input_tvm, output_tvm) diff --git a/tests/python/topi/python/test_topi_group_conv2d.py b/tests/python/topi/python/test_topi_group_conv2d.py index 45e77d19082d..9c4da5c2c849 100644 --- a/tests/python/topi/python/test_topi_group_conv2d.py +++ b/tests/python/topi/python/test_topi_group_conv2d.py @@ -24,7 +24,7 @@ from tvm import topi import tvm.topi.testing from tvm.contrib.pickle_memoize import memoize -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple from common import Int8Fallback import tvm.testing diff --git a/tests/python/topi/python/test_topi_group_conv2d_NCHWc_int8.py b/tests/python/topi/python/test_topi_group_conv2d_NCHWc_int8.py index 89e0e04206c7..b6cef2e97662 100644 --- a/tests/python/topi/python/test_topi_group_conv2d_NCHWc_int8.py +++ b/tests/python/topi/python/test_topi_group_conv2d_NCHWc_int8.py @@ -25,7 +25,7 @@ import tvm.testing import tvm.topi.testing from tvm.contrib.pickle_memoize import memoize -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple import pytest diff --git a/tests/python/topi/python/test_topi_lrn.py b/tests/python/topi/python/test_topi_lrn.py index 7e3300c39dc7..278926479977 100644 --- a/tests/python/topi/python/test_topi_lrn.py +++ b/tests/python/topi/python/test_topi_lrn.py @@ -19,7 +19,7 @@ import tvm from tvm import te from tvm import topi -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple import tvm.topi.testing import tvm.testing diff --git a/tests/python/topi/python/test_topi_math.py b/tests/python/topi/python/test_topi_math.py index 149ed82b150c..6e119e7aef6e 100644 --- a/tests/python/topi/python/test_topi_math.py +++ b/tests/python/topi/python/test_topi_math.py @@ -22,13 +22,13 @@ from tvm import topi import tvm.testing import tvm.topi.testing -from tvm.topi import util +from tvm.topi import utils def test_util(): x = tvm.tir.const(100, "int32") - assert util.get_const_int(x) == 100 - assert util.get_const_tuple((x, x)) == (100, 100) + assert utils.get_const_int(x) == 100 + assert utils.get_const_tuple((x, x)) == (100, 100) @tvm.testing.uses_gpu diff --git a/tests/python/topi/python/test_topi_matmul.py b/tests/python/topi/python/test_topi_matmul.py index f6933d7247f4..26ba6f8142b4 100644 --- a/tests/python/topi/python/test_topi_matmul.py +++ b/tests/python/topi/python/test_topi_matmul.py @@ -19,7 +19,7 @@ import tvm.testing from tvm import te from tvm import topi -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple def with_tvm(lam, *args): diff --git a/tests/python/topi/python/test_topi_pooling.py b/tests/python/topi/python/test_topi_pooling.py index 251172f5a185..6f62b8ad969b 100644 --- a/tests/python/topi/python/test_topi_pooling.py +++ b/tests/python/topi/python/test_topi_pooling.py @@ -23,7 +23,7 @@ from tvm import topi import tvm.testing import tvm.topi.testing -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple import tvm.testing _pool_schedule = { diff --git a/tests/python/topi/python/test_topi_relu.py b/tests/python/topi/python/test_topi_relu.py index aa68f235f795..7c45acae0570 100644 --- a/tests/python/topi/python/test_topi_relu.py +++ b/tests/python/topi/python/test_topi_relu.py @@ -21,7 +21,7 @@ from tvm import te from tvm import topi import tvm.topi.testing -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple from tvm.contrib.nvcc import have_fp16 import tvm.testing diff --git a/tests/python/topi/python/test_topi_reorg.py b/tests/python/topi/python/test_topi_reorg.py index 37a0eb95d8eb..93464d9bef03 100644 --- a/tests/python/topi/python/test_topi_reorg.py +++ b/tests/python/topi/python/test_topi_reorg.py @@ -17,7 +17,7 @@ """Example code to do reorg.""" import numpy as np from tvm import topi -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple import tvm from tvm import te import tvm.topi.testing diff --git a/tests/python/topi/python/test_topi_softmax.py b/tests/python/topi/python/test_topi_softmax.py index df4c4ea3bf0b..66c44f937c5e 100644 --- a/tests/python/topi/python/test_topi_softmax.py +++ b/tests/python/topi/python/test_topi_softmax.py @@ -23,7 +23,7 @@ import tvm.testing import tvm.topi.testing import logging -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple _softmax_schedule = { diff --git a/tests/python/topi/python/test_topi_sparse.py b/tests/python/topi/python/test_topi_sparse.py index 9426eb7499df..62f49e21418f 100644 --- a/tests/python/topi/python/test_topi_sparse.py +++ b/tests/python/topi/python/test_topi_sparse.py @@ -21,7 +21,7 @@ from tvm import topi from tvm import relay import tvm.topi.testing -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple import tvm.contrib.sparse as tvmsp from collections import namedtuple import time diff --git a/tests/python/topi/python/test_topi_upsampling.py b/tests/python/topi/python/test_topi_upsampling.py index 85042c032d03..0408220bfd65 100644 --- a/tests/python/topi/python/test_topi_upsampling.py +++ b/tests/python/topi/python/test_topi_upsampling.py @@ -22,7 +22,7 @@ import tvm.testing import tvm.topi.testing import math -from tvm.topi.util import nchw_pack_layout +from tvm.topi.utils import nchw_pack_layout def verify_upsampling( diff --git a/tests/python/topi/python/test_topi_util.py b/tests/python/topi/python/test_topi_util.py index 18182dc27b11..bd7585e56302 100644 --- a/tests/python/topi/python/test_topi_util.py +++ b/tests/python/topi/python/test_topi_util.py @@ -20,7 +20,7 @@ def verify_get_shape(src_shape, src_layout, dst_layout, expect_shape): - dst_shape = topi.util.get_shape(src_shape, src_layout, dst_layout) + dst_shape = topi.utils.get_shape(src_shape, src_layout, dst_layout) assert dst_shape == expect_shape, "Shape mismatch: expecting %s but got %s" % ( expect_shape, dst_shape, diff --git a/tests/python/topi/python/test_topi_vision.py b/tests/python/topi/python/test_topi_vision.py index 0d02dd8b3311..24035ba9bba6 100644 --- a/tests/python/topi/python/test_topi_vision.py +++ b/tests/python/topi/python/test_topi_vision.py @@ -24,7 +24,7 @@ import tvm.topi.testing from tvm.contrib.pickle_memoize import memoize -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple from tvm.topi.vision import ssd, non_max_suppression, get_valid_counts import pytest import tvm.testing diff --git a/tests/python/unittest/test_auto_scheduler_common.py b/tests/python/unittest/test_auto_scheduler_common.py index 764099e7bd07..6a3fe4e82c99 100644 --- a/tests/python/unittest/test_auto_scheduler_common.py +++ b/tests/python/unittest/test_auto_scheduler_common.py @@ -23,7 +23,7 @@ from tvm import te, auto_scheduler from tvm import topi from tvm.topi.nn.winograd_util import winograd_transform_matrices -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple @auto_scheduler.register_workload diff --git a/tests/python/unittest/test_autotvm_record.py b/tests/python/unittest/test_autotvm_record.py index c9d2c49de5f7..51cc9074a4fe 100644 --- a/tests/python/unittest/test_autotvm_record.py +++ b/tests/python/unittest/test_autotvm_record.py @@ -19,7 +19,7 @@ import tvm from tvm import te -from tvm.contrib import util +from tvm.contrib import utils from tvm import autotvm from tvm.autotvm.measure import MeasureInput, MeasureResult, MeasureErrorNo @@ -50,7 +50,7 @@ def test_load_dump(): def test_file_io(): - temp = util.tempdir() + temp = utils.tempdir() file_path = temp.relpath("temp.log") tsk, target = get_sample_task() diff --git a/tests/python/unittest/test_crt.py b/tests/python/unittest/test_crt.py index 04018daca478..3b5471d0bb8b 100644 --- a/tests/python/unittest/test_crt.py +++ b/tests/python/unittest/test_crt.py @@ -29,7 +29,7 @@ import tvm import tvm.relay -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple from tvm.topi.testing import conv2d_nchw_python BUILD = True diff --git a/tests/python/unittest/test_format_si_prefix.py b/tests/python/unittest/test_format_si_prefix.py index b655654d6ae3..4df5c2b8cd13 100644 --- a/tests/python/unittest/test_format_si_prefix.py +++ b/tests/python/unittest/test_format_si_prefix.py @@ -17,7 +17,7 @@ from numpy import isclose import random -from tvm.autotvm import util +from tvm.autotvm import utils SI_PREFIXES = "yzafpn\xb5m kMGTPEZY" @@ -25,16 +25,16 @@ def test_format_si_prefix(): # test float conversion - assert util.format_si_prefix(1024, "k") == 1.024 + assert utils.format_si_prefix(1024, "k") == 1.024 for i, prefix in enumerate(SI_PREFIXES): integer, decimal = random.randint(0, 1000), random.randint(0, 1000) exp = -24 + 3 * i # 0th prefix (yocto) is 10^-24 number = integer * (10 ** exp) + decimal * (10 ** (exp - 3)) expected = integer + decimal / 1000 - assert isclose(util.format_si_prefix(number, prefix), expected) + assert isclose(utils.format_si_prefix(number, prefix), expected) - assert util.format_si_prefix(0, "y") == 0 + assert utils.format_si_prefix(0, "y") == 0 if __name__ == "__main__": diff --git a/tests/python/unittest/test_micro_artifact.py b/tests/python/unittest/test_micro_artifact.py index 80d34db6384f..d757f0956b81 100644 --- a/tests/python/unittest/test_micro_artifact.py +++ b/tests/python/unittest/test_micro_artifact.py @@ -22,7 +22,7 @@ import shutil import tvm -from tvm.contrib import util +from tvm.contrib import utils FILE_LIST = ["label1", "label2", "label12", "unlabelled"] @@ -58,7 +58,7 @@ def build_artifact(artifact_path, immobile=False): @tvm.testing.requires_micro def test_basic_functionality(): - temp_dir = util.tempdir() + temp_dir = utils.tempdir() artifact_path = temp_dir.relpath("foo") art = build_artifact(artifact_path) @@ -73,7 +73,7 @@ def test_basic_functionality(): def test_archive(): from tvm.micro import artifact - temp_dir = util.tempdir() + temp_dir = utils.tempdir() art = build_artifact(temp_dir.relpath("foo")) # Create archive @@ -110,7 +110,7 @@ def test_archive(): def test_metadata_only(): from tvm.micro import artifact - temp_dir = util.tempdir() + temp_dir = utils.tempdir() base_dir = temp_dir.relpath("foo") art = build_artifact(base_dir) diff --git a/tests/python/unittest/test_runtime_graph.py b/tests/python/unittest/test_runtime_graph.py index 5968f0b0e02b..c43a35924420 100644 --- a/tests/python/unittest/test_runtime_graph.py +++ b/tests/python/unittest/test_runtime_graph.py @@ -20,7 +20,7 @@ import numpy as np import json from tvm import rpc -from tvm.contrib import util, graph_runtime +from tvm.contrib import utils, graph_runtime @tvm.testing.requires_llvm @@ -68,7 +68,7 @@ def check_remote(): mlib = tvm.build(s, [A, B], "llvm", name="myadd") server = rpc.Server("localhost") remote = rpc.connect(server.host, server.port) - temp = util.tempdir() + temp = utils.tempdir() ctx = remote.cpu(0) path_dso = temp.relpath("dev_lib.so") mlib.export_library(path_dso) diff --git a/tests/python/unittest/test_runtime_graph_debug.py b/tests/python/unittest/test_runtime_graph_debug.py index 25dadbd44acf..8aeaf1a1a23b 100644 --- a/tests/python/unittest/test_runtime_graph_debug.py +++ b/tests/python/unittest/test_runtime_graph_debug.py @@ -21,7 +21,7 @@ from tvm import te import numpy as np from tvm import rpc -from tvm.contrib import util +from tvm.contrib import utils from tvm.contrib.debugger import debug_runtime as graph_runtime @@ -120,7 +120,7 @@ def check_remote(): mlib = tvm.build(s, [A, B], "llvm", name="myadd") server = rpc.Server("localhost") remote = rpc.connect(server.host, server.port) - temp = util.tempdir() + temp = utils.tempdir() ctx = remote.cpu(0) path_dso = temp.relpath("dev_lib.so") mlib.export_library(path_dso) diff --git a/tests/python/unittest/test_runtime_heterogeneous.py b/tests/python/unittest/test_runtime_heterogeneous.py index 80b330c77004..161f944ea7bb 100644 --- a/tests/python/unittest/test_runtime_heterogeneous.py +++ b/tests/python/unittest/test_runtime_heterogeneous.py @@ -21,7 +21,7 @@ import tvm from tvm import te -from tvm.contrib import graph_runtime, util +from tvm.contrib import graph_runtime, utils from tvm import topi @@ -415,7 +415,7 @@ def check_verify(): np.testing.assert_equal(out.asnumpy(), tensor_a + tensor_b - tensor_c + tensor_d) def check_load_module(): - temp = util.tempdir() + temp = utils.tempdir() path_lib = temp.relpath("deploy.so") mhost.export_library(path_lib) with open(temp.relpath("deploy.json"), "w") as out_file: diff --git a/tests/python/unittest/test_runtime_measure.py b/tests/python/unittest/test_runtime_measure.py index 77f32a05ea61..0d02f910a44c 100644 --- a/tests/python/unittest/test_runtime_measure.py +++ b/tests/python/unittest/test_runtime_measure.py @@ -19,7 +19,7 @@ import tvm from tvm import te -from tvm.contrib.util import tempdir +from tvm.contrib.utils import tempdir def test_min_repeat_ms(): diff --git a/tests/python/unittest/test_runtime_module_based_interface.py b/tests/python/unittest/test_runtime_module_based_interface.py index 1d682d2fccdd..56ebb29c7c65 100644 --- a/tests/python/unittest/test_runtime_module_based_interface.py +++ b/tests/python/unittest/test_runtime_module_based_interface.py @@ -126,9 +126,9 @@ def verify_cpu_export(obj_format): with relay.build_config(opt_level=3): complied_graph_lib = relay.build_module.build(mod, "llvm", params=params) - from tvm.contrib import util + from tvm.contrib import utils - temp = util.tempdir() + temp = utils.tempdir() if obj_format == ".so": file_name = "deploy_lib.so" else: @@ -165,9 +165,9 @@ def verify_gpu_export(obj_format): with relay.build_config(opt_level=3): complied_graph_lib = relay.build_module.build(mod, "cuda", params=params) - from tvm.contrib import util + from tvm.contrib import utils - temp = util.tempdir() + temp = utils.tempdir() if obj_format == ".so": file_name = "deploy_lib.so" else: @@ -204,9 +204,9 @@ def verify_rpc_cpu_export(obj_format): with relay.build_config(opt_level=3): complied_graph_lib = relay.build_module.build(mod, "llvm", params=params) - from tvm.contrib import util + from tvm.contrib import utils - temp = util.tempdir() + temp = utils.tempdir() if obj_format == ".so": file_name = "deploy_lib.so" else: @@ -248,9 +248,9 @@ def verify_rpc_gpu_export(obj_format): with relay.build_config(opt_level=3): complied_graph_lib = relay.build_module.build(mod, "cuda", params=params) - from tvm.contrib import util + from tvm.contrib import utils - temp = util.tempdir() + temp = utils.tempdir() if obj_format == ".so": file_name = "deploy_lib.so" else: @@ -302,9 +302,9 @@ def verify_cpu_remove_package_params(obj_format): with relay.build_config(opt_level=3): complied_graph_lib = relay.build_module.build(mod, "llvm", params=params) - from tvm.contrib import util + from tvm.contrib import utils - temp = util.tempdir() + temp = utils.tempdir() if obj_format == ".so": file_name = "deploy_lib.so" else: @@ -349,9 +349,9 @@ def verify_gpu_remove_package_params(obj_format): with relay.build_config(opt_level=3): complied_graph_lib = relay.build_module.build(mod, "cuda", params=params) - from tvm.contrib import util + from tvm.contrib import utils - temp = util.tempdir() + temp = utils.tempdir() if obj_format == ".so": file_name = "deploy_lib.so" else: @@ -396,9 +396,9 @@ def verify_rpc_cpu_remove_package_params(obj_format): with relay.build_config(opt_level=3): complied_graph_lib = relay.build_module.build(mod, "llvm", params=params) - from tvm.contrib import util + from tvm.contrib import utils - temp = util.tempdir() + temp = utils.tempdir() if obj_format == ".so": file_name = "deploy_lib.so" else: @@ -449,9 +449,9 @@ def verify_rpc_gpu_remove_package_params(obj_format): with relay.build_config(opt_level=3): complied_graph_lib = relay.build_module.build(mod, "cuda", params=params) - from tvm.contrib import util + from tvm.contrib import utils - temp = util.tempdir() + temp = utils.tempdir() if obj_format == ".so": file_name = "deploy_lib.so" else: diff --git a/tests/python/unittest/test_runtime_module_export.py b/tests/python/unittest/test_runtime_module_export.py index fcdd906032af..88b7af984073 100644 --- a/tests/python/unittest/test_runtime_module_export.py +++ b/tests/python/unittest/test_runtime_module_export.py @@ -21,9 +21,9 @@ import tvm.testing -from tvm.contrib import util +from tvm.contrib import utils -header_file_dir_path = util.tempdir() +header_file_dir_path = utils.tempdir() def gen_engine_header(): @@ -80,9 +80,9 @@ def verify_gpu_mod_export(obj_format): synthetic_llvm_mod, "llvm", params=synthetic_llvm_params ) - from tvm.contrib import util + from tvm.contrib import utils - temp = util.tempdir() + temp = utils.tempdir() if obj_format == ".so": file_name = "deploy_lib.so" else: @@ -112,9 +112,9 @@ def verify_multi_dso_mod_export(obj_format): B = te.compute(A.shape, lambda *i: A(*i) + 1.0, name="B") s = te.create_schedule(B.op) f = tvm.build(s, [A, B], "llvm", name="myadd") - from tvm.contrib import util + from tvm.contrib import utils - temp = util.tempdir() + temp = utils.tempdir() if obj_format == ".so": file_name = "deploy_lib.so" else: @@ -153,9 +153,9 @@ def verify_json_import_dso(obj_format): + "mul 6 inputs: 5 3 shape: 10 10" ) - from tvm.contrib import util + from tvm.contrib import utils - temp = util.tempdir() + temp = utils.tempdir() subgraph_path = temp.relpath("subgraph.examplejson") with open(subgraph_path, "w") as f: f.write(subgraph_json) @@ -204,9 +204,9 @@ def verify_multi_c_mod_export(): s = te.create_schedule(B.op) f = tvm.build(s, [A, B], "c", name="myadd") engine_module = generate_engine_module() - from tvm.contrib import util + from tvm.contrib import utils - temp = util.tempdir() + temp = utils.tempdir() file_name = "deploy_lib.so" path_lib = temp.relpath(file_name) synthetic_cpu_lib.import_module(f) diff --git a/tests/python/unittest/test_runtime_module_load.py b/tests/python/unittest/test_runtime_module_load.py index 81aa2ba5cc95..7befed3bbcdd 100644 --- a/tests/python/unittest/test_runtime_module_load.py +++ b/tests/python/unittest/test_runtime_module_load.py @@ -16,7 +16,7 @@ # under the License. import tvm from tvm import te -from tvm.contrib import cc, util +from tvm.contrib import cc, utils import ctypes import os import sys @@ -47,7 +47,7 @@ def test_dso_module_load(): if not tvm.testing.device_enabled("llvm"): return dtype = "int64" - temp = util.tempdir() + temp = utils.tempdir() def save_object(names): n = te.size_var("n") @@ -105,7 +105,7 @@ def check_device(device): if not tvm.testing.device_enabled(device): print("Skip because %s is not enabled" % device) return - temp = util.tempdir() + temp = utils.tempdir() name = "myadd_%s" % device if sys.platform == "darwin" or sys.platform.startswith("linux"): f = tvm.build(s, [A, B], device, "llvm -system-lib", name=name) @@ -133,7 +133,7 @@ def check_stackvm(device): if not tvm.testing.device_enabled(device): print("Skip because %s is not enabled" % device) return - temp = util.tempdir() + temp = utils.tempdir() name = "myadd_%s" % device f = tvm.build(s, [A, B], device, "stackvm", name=name) path_dso = temp.relpath("dev_lib.stackvm") @@ -163,7 +163,7 @@ def check_llvm(): if not tvm.testing.device_enabled("llvm"): print("Skip because llvm is not enabled") return - temp = util.tempdir() + temp = utils.tempdir() fadd1 = tvm.build(s, [A, B], "llvm", name="myadd1") fadd2 = tvm.build(s, [A, B], "llvm", name="myadd2") path1 = temp.relpath("myadd1.o") @@ -188,7 +188,7 @@ def check_system_lib(): if not tvm.testing.device_enabled("llvm"): print("Skip because llvm is not enabled") return - temp = util.tempdir() + temp = utils.tempdir() fadd1 = tvm.build(s, [A, B], "llvm -system-lib", name="myadd1") fadd2 = tvm.build(s, [A, B], "llvm -system-lib", name="myadd2") path1 = temp.relpath("myadd1.o") diff --git a/tests/python/unittest/test_runtime_rpc.py b/tests/python/unittest/test_runtime_rpc.py index d25eff23ae76..e0fe8b5fe26f 100644 --- a/tests/python/unittest/test_runtime_rpc.py +++ b/tests/python/unittest/test_runtime_rpc.py @@ -26,7 +26,7 @@ import pytest import numpy as np from tvm import rpc -from tvm.contrib import util, cc +from tvm.contrib import utils, cc from tvm.rpc.tracker import Tracker @@ -46,7 +46,7 @@ def verify_rpc(remote, target, shape, dtype): ctx = remote.cpu(0) a = tvm.nd.array(np.random.randint(0, 256, size=shape).astype(A.dtype), ctx=ctx) b = tvm.nd.array(np.zeros(shape).astype(A.dtype), ctx=ctx) - temp = util.tempdir() + temp = utils.tempdir() path_dso = temp.relpath("dev_lib.o") f.save(path_dso) remote.upload(path_dso) @@ -164,7 +164,7 @@ def check_minrpc(): if tvm.get_global_func("rpc.CreatePipeClient", allow_missing=True) is None: return # Test minrpc server. - temp = util.tempdir() + temp = utils.tempdir() minrpc_exec = temp.relpath("minrpc") tvm.rpc.with_minrpc(cc.create_executable)(minrpc_exec, []) check(rpc.PopenSession(minrpc_exec)) @@ -212,7 +212,7 @@ def test_rpc_remote_module(): ) def check_remote(remote): - temp = util.tempdir() + temp = utils.tempdir() ctx = remote.cpu(0) f = tvm.build(s, [A, B], "llvm", name="myadd") path_dso = temp.relpath("dev_lib.so") @@ -243,7 +243,7 @@ def check_minrpc(): if tvm.get_global_func("rpc.CreatePipeClient", allow_missing=True) is None: return # export to minrpc - temp = util.tempdir() + temp = utils.tempdir() f = tvm.build(s, [A, B], "llvm --system-lib", name="myadd") path_minrpc = temp.relpath("dev_lib.minrpc") f.export_library(path_minrpc, rpc.with_minrpc(cc.create_executable)) @@ -278,7 +278,7 @@ def check_remote_link_cl(remote): if not tvm.testing.device_enabled("opencl"): print("Skip because opencl is not enabled") return - temp = util.tempdir() + temp = utils.tempdir() ctx = remote.cl(0) s = te.create_schedule(B.op) xo, xi = s[B].split(B.op.axis[0], factor=32) diff --git a/tests/python/unittest/test_target_codegen_blob.py b/tests/python/unittest/test_target_codegen_blob.py index 8189d1384e92..dc42381cf82d 100644 --- a/tests/python/unittest/test_target_codegen_blob.py +++ b/tests/python/unittest/test_target_codegen_blob.py @@ -49,9 +49,9 @@ def verify(data): with tvm.transform.PassContext(opt_level=3): synthetic_gpu_lib = relay.build_module.build(synthetic_mod, "cuda", params=synthetic_params) - from tvm.contrib import util + from tvm.contrib import utils - temp = util.tempdir() + temp = utils.tempdir() path_lib = temp.relpath("deploy_lib.so") synthetic_gpu_lib.export_library(path_lib) @@ -82,9 +82,9 @@ def test_cuda_lib(): s[B].bind(bx, te.thread_axis("blockIdx.x")) s[B].bind(tx, te.thread_axis("threadIdx.x")) - from tvm.contrib import util + from tvm.contrib import utils - temp = util.tempdir() + temp = utils.tempdir() fn_add = tvm.build(s, [A, B], target="cuda", target_host="llvm", name="add") path_lib = temp.relpath("deploy_lib.so") fn_add.export_library(path_lib) diff --git a/tests/python/unittest/test_target_codegen_c_host.py b/tests/python/unittest/test_target_codegen_c_host.py index a2ed6345e651..3178d6dad0e4 100644 --- a/tests/python/unittest/test_target_codegen_c_host.py +++ b/tests/python/unittest/test_target_codegen_c_host.py @@ -18,7 +18,7 @@ import tvm.testing from tvm import te import numpy as np -from tvm.contrib import util +from tvm.contrib import utils def test_add(): @@ -31,7 +31,7 @@ def test_add(): def check_c(): mhost = tvm.build(s, [A, B, C], "c", name="fadd") - temp = util.tempdir() + temp = utils.tempdir() path_dso = temp.relpath("temp.so") mhost.export_library(path_dso) m = tvm.runtime.load_module(path_dso) @@ -76,7 +76,7 @@ def check_c(): f1 = tvm.lower(s, [A, B, C], name="fadd_pipeline") mhost = tvm.build(f1, target="c") - temp = util.tempdir() + temp = utils.tempdir() path_dso = temp.relpath("temp.so") mhost.export_library(path_dso) m = tvm.runtime.load_module(path_dso) @@ -104,7 +104,7 @@ def test_reinterpret(): def check_c(): mhost = tvm.build(s, [A, B], "c", name="reinterpret") - temp = util.tempdir() + temp = utils.tempdir() path_dso = temp.relpath("temp.so") mhost.export_library(path_dso) m = tvm.runtime.load_module(path_dso) diff --git a/tests/python/unittest/test_target_codegen_cross_llvm.py b/tests/python/unittest/test_target_codegen_cross_llvm.py index c0ab65100d52..a55530a090e4 100644 --- a/tests/python/unittest/test_target_codegen_cross_llvm.py +++ b/tests/python/unittest/test_target_codegen_cross_llvm.py @@ -21,7 +21,7 @@ import os import struct from tvm import rpc -from tvm.contrib import util, cc +from tvm.contrib import utils, cc import numpy as np @@ -46,7 +46,7 @@ def verify_elf(path, e_machine): assert struct.unpack(endian + "h", arr[0x12:0x14])[0] == e_machine def build_i386(): - temp = util.tempdir() + temp = utils.tempdir() target = "llvm -mtriple=i386-pc-linux-gnu" f = tvm.build(s, [A, B, C], target) path = temp.relpath("myadd.o") @@ -58,7 +58,7 @@ def build_arm(): if not tvm.runtime.enabled(target): print("Skip because %s is not enabled.." % target) return - temp = util.tempdir() + temp = utils.tempdir() f = tvm.build(s, [A, B, C], target) path = temp.relpath("myadd.o") f.save(path) diff --git a/tests/python/unittest/test_target_codegen_device.py b/tests/python/unittest/test_target_codegen_device.py index 3cdcb2d7345b..3b764c6709a8 100644 --- a/tests/python/unittest/test_target_codegen_device.py +++ b/tests/python/unittest/test_target_codegen_device.py @@ -16,7 +16,7 @@ # under the License. import tvm from tvm import te -from tvm.contrib import util +from tvm.contrib import utils import numpy as np import tvm.testing diff --git a/tests/python/unittest/test_target_codegen_llvm.py b/tests/python/unittest/test_target_codegen_llvm.py index 19773e59a777..3599493a74cb 100644 --- a/tests/python/unittest/test_target_codegen_llvm.py +++ b/tests/python/unittest/test_target_codegen_llvm.py @@ -18,7 +18,7 @@ import tvm.testing from tvm import te from tvm import topi -from tvm.contrib import util, clang +from tvm.contrib import utils, clang import numpy as np import ctypes import math @@ -594,7 +594,7 @@ def check_llvm_object(): f2 = tvm.lower(s, [A, B, C], name="fadd1") f1 = tvm.lower(s, [A, B, C], name="fadd2") m = tvm.build([f1, f2], "llvm") - temp = util.tempdir() + temp = utils.tempdir() o_path = temp.relpath("temp.o") m.save(o_path) import shutil diff --git a/tests/python/unittest/test_te_autodiff.py b/tests/python/unittest/test_te_autodiff.py index 7b591dcd87f1..6031182091fe 100644 --- a/tests/python/unittest/test_te_autodiff.py +++ b/tests/python/unittest/test_te_autodiff.py @@ -19,7 +19,7 @@ from tvm import te from tvm.testing import assert_allclose from tvm import topi -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple import pytest import numpy as np diff --git a/tests/python/unittest/test_te_hybrid_script.py b/tests/python/unittest/test_te_hybrid_script.py index 3afdb66134e3..06d409933f1f 100644 --- a/tests/python/unittest/test_te_hybrid_script.py +++ b/tests/python/unittest/test_te_hybrid_script.py @@ -17,7 +17,7 @@ import tvm, inspect, sys, traceback, numpy, pytest, types, os from tvm import te -from tvm.contrib import util +from tvm.contrib import utils from tvm.te.hybrid import script from tvm.te.hybrid.runtime import HYBRID_GLOBALS @@ -147,7 +147,7 @@ def test_outer_product(): assert mul.b.producer.name == "b" func, ins, outs = run_and_check(outer_product, [n, m, a, b], {n: 99, m: 101}) - temp = util.tempdir() + temp = utils.tempdir() path = temp.relpath("%s.py" % func.name) func.save(path) func_ = te.hybrid.HybridModule() diff --git a/tests/python/unittest/test_te_tensor_overload.py b/tests/python/unittest/test_te_tensor_overload.py index a8339154b09b..3126d8484e35 100644 --- a/tests/python/unittest/test_te_tensor_overload.py +++ b/tests/python/unittest/test_te_tensor_overload.py @@ -19,7 +19,7 @@ from tvm import te from tvm import topi import tvm.topi.testing -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple import tvm.testing diff --git a/tests/python/unittest/test_tir_data_layout.py b/tests/python/unittest/test_tir_data_layout.py index 22c24fafc54f..5c2eb8febd9b 100644 --- a/tests/python/unittest/test_tir_data_layout.py +++ b/tests/python/unittest/test_tir_data_layout.py @@ -18,7 +18,7 @@ import tvm from tvm import te -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple def test_layout(): diff --git a/tests/python/unittest/test_tir_intrin.py b/tests/python/unittest/test_tir_intrin.py index 3d54175b8731..76390dace757 100644 --- a/tests/python/unittest/test_tir_intrin.py +++ b/tests/python/unittest/test_tir_intrin.py @@ -18,7 +18,7 @@ import tvm.testing from tvm import te from tvm import topi -from tvm.contrib import util, clang +from tvm.contrib import utils, clang import numpy as np import ctypes import math diff --git a/tests/scripts/task_golang.sh b/tests/scripts/task_golang.sh index 7a93b47c2913..5b01eeca164c 100755 --- a/tests/scripts/task_golang.sh +++ b/tests/scripts/task_golang.sh @@ -28,5 +28,7 @@ export PYTHONPATH="$tvm_root/python" export TVM_BIND_THREADS=0 export OMP_NUM_THREADS=1 +make -C golang clean + # Golang tests make -C golang tests diff --git a/tutorials/autotvm/tune_relay_arm.py b/tutorials/autotvm/tune_relay_arm.py index 31fda54a9a7e..7514ee708292 100644 --- a/tutorials/autotvm/tune_relay_arm.py +++ b/tutorials/autotvm/tune_relay_arm.py @@ -71,7 +71,7 @@ from tvm import relay import tvm.relay.testing from tvm.autotvm.tuner import XGBTuner, GATuner, RandomTuner, GridSearchTuner -from tvm.contrib.util import tempdir +from tvm.contrib.utils import tempdir import tvm.contrib.graph_runtime as runtime ################################################################# @@ -416,4 +416,4 @@ def tune_and_evaluate(tuning_opt): # import logging # logging.getLogger('autotvm').setLevel(logging.DEBUG) # -# Finally, always feel free to ask our community for help on https://discuss.tvm.ai +# Finally, always feel free to ask our community for help on https://discuss.tvm.apache.org diff --git a/tutorials/autotvm/tune_relay_cuda.py b/tutorials/autotvm/tune_relay_cuda.py index e86430767b31..f9b89211a066 100644 --- a/tutorials/autotvm/tune_relay_cuda.py +++ b/tutorials/autotvm/tune_relay_cuda.py @@ -69,7 +69,7 @@ from tvm import relay import tvm.relay.testing from tvm.autotvm.tuner import XGBTuner, GATuner, RandomTuner, GridSearchTuner -from tvm.contrib.util import tempdir +from tvm.contrib.utils import tempdir import tvm.contrib.graph_runtime as runtime ################################################################# @@ -317,7 +317,7 @@ def tune_and_evaluate(tuning_opt): # import logging # logging.getLogger('autotvm').setLevel(logging.DEBUG) # -# Finally, always feel free to ask our community for help on https://discuss.tvm.ai +# Finally, always feel free to ask our community for help on https://discuss.tvm.apache.org ################################################################# diff --git a/tutorials/autotvm/tune_relay_mobile_gpu.py b/tutorials/autotvm/tune_relay_mobile_gpu.py index 9a112e134f4f..b7fbf89e59aa 100644 --- a/tutorials/autotvm/tune_relay_mobile_gpu.py +++ b/tutorials/autotvm/tune_relay_mobile_gpu.py @@ -70,7 +70,7 @@ from tvm import relay import tvm.relay.testing from tvm.autotvm.tuner import XGBTuner, GATuner, RandomTuner, GridSearchTuner -from tvm.contrib.util import tempdir +from tvm.contrib.utils import tempdir import tvm.contrib.graph_runtime as runtime ################################################################# @@ -421,4 +421,4 @@ def tune_and_evaluate(tuning_opt): # import logging # logging.getLogger('autotvm').setLevel(logging.DEBUG) # -# Finally, always feel free to ask our community for help on https://discuss.tvm.ai +# Finally, always feel free to ask our community for help on https://discuss.tvm.apache.org diff --git a/tutorials/frontend/deploy_model_on_android.py b/tutorials/frontend/deploy_model_on_android.py index 851810a83958..35f989c7a5ca 100644 --- a/tutorials/frontend/deploy_model_on_android.py +++ b/tutorials/frontend/deploy_model_on_android.py @@ -34,7 +34,7 @@ from tvm import te import tvm.relay as relay from tvm import rpc -from tvm.contrib import util, ndk, graph_runtime as runtime +from tvm.contrib import utils, ndk, graph_runtime as runtime from tvm.contrib.download import download_testdata @@ -282,7 +282,7 @@ def transform_image(image): # change the parameters but keep the result of model as the same. # Save the library at local temporary directory. -tmp = util.tempdir() +tmp = utils.tempdir() lib_fname = tmp.relpath("net.so") fcompile = ndk.create_shared if not local_demo else None lib.export_library(lib_fname, fcompile) diff --git a/tutorials/frontend/deploy_model_on_rasp.py b/tutorials/frontend/deploy_model_on_rasp.py index 8b49a213ef36..36879910a1b9 100644 --- a/tutorials/frontend/deploy_model_on_rasp.py +++ b/tutorials/frontend/deploy_model_on_rasp.py @@ -30,7 +30,7 @@ from tvm import te import tvm.relay as relay from tvm import rpc -from tvm.contrib import util, graph_runtime as runtime +from tvm.contrib import utils, graph_runtime as runtime from tvm.contrib.download import download_testdata ###################################################################### @@ -193,7 +193,7 @@ def transform_image(image): # change the parameters but keep the result of model as the same. # Save the library at local temporary directory. -tmp = util.tempdir() +tmp = utils.tempdir() lib_fname = tmp.relpath("net.tar") lib.export_library(lib_fname) diff --git a/tutorials/frontend/deploy_prequantized.py b/tutorials/frontend/deploy_prequantized.py index e9f1a4c7c326..beba332a8a26 100644 --- a/tutorials/frontend/deploy_prequantized.py +++ b/tutorials/frontend/deploy_prequantized.py @@ -22,7 +22,7 @@ This is a tutorial on loading models quantized by deep learning frameworks into TVM. Pre-quantized model import is one of the quantization support we have in TVM. More details on the quantization story in TVM can be found -`here `_. +`here `_. Here, we demonstrate how to load and run models quantized by PyTorch, MXNet, and TFLite. Once loaded, we can run compiled, quantized models on any hardware TVM supports. diff --git a/tutorials/frontend/deploy_quantized.py b/tutorials/frontend/deploy_quantized.py index 093bd732eb3c..e75f6e92a6f1 100644 --- a/tutorials/frontend/deploy_quantized.py +++ b/tutorials/frontend/deploy_quantized.py @@ -22,7 +22,7 @@ This article is an introductory tutorial of automatic quantization with TVM. Automatic quantization is one of the quantization modes in TVM. More details on the quantization story in TVM can be found -`here `_. +`here `_. In this tutorial, we will import a GluonCV pre-trained model on ImageNet to Relay, quantize the Relay model and then perform the inference. """ diff --git a/tutorials/frontend/from_onnx.py b/tutorials/frontend/from_onnx.py index 141defe65488..1557ea551d28 100644 --- a/tutorials/frontend/from_onnx.py +++ b/tutorials/frontend/from_onnx.py @@ -111,4 +111,4 @@ # retains that dynamism upon import, and the compiler attemps to convert the model # into a static shapes at compile time. If this fails, there may still be dynamic # operations in the model. Not all TVM kernels currently support dynamic shapes, -# please file an issue on discuss.tvm.ai if you hit an error with dynamic kernels. +# please file an issue on discuss.tvm.apache.org if you hit an error with dynamic kernels. diff --git a/tutorials/get_started/cross_compilation_and_rpc.py b/tutorials/get_started/cross_compilation_and_rpc.py index 572ebb897e3c..69284c0521a3 100644 --- a/tutorials/get_started/cross_compilation_and_rpc.py +++ b/tutorials/get_started/cross_compilation_and_rpc.py @@ -98,7 +98,7 @@ import tvm from tvm import te from tvm import rpc -from tvm.contrib import util +from tvm.contrib import utils n = tvm.runtime.convert(1024) A = te.placeholder((n,), name="A") @@ -120,7 +120,7 @@ func = tvm.build(s, [A, B], target=target, name="add_one") # save the lib at a local temp folder -temp = util.tempdir() +temp = utils.tempdir() path = temp.relpath("lib.tar") func.export_library(path) diff --git a/tutorials/get_started/relay_quick_start.py b/tutorials/get_started/relay_quick_start.py index cece7ab04316..6da62f5ced4b 100644 --- a/tutorials/get_started/relay_quick_start.py +++ b/tutorials/get_started/relay_quick_start.py @@ -129,9 +129,9 @@ #################################################### # save the graph, lib and params into separate files -from tvm.contrib import util +from tvm.contrib import utils -temp = util.tempdir() +temp = utils.tempdir() path_lib = temp.relpath("deploy_lib.tar") lib.export_library(path_lib) print(temp.listdir()) diff --git a/tutorials/get_started/tensor_expr_get_started.py b/tutorials/get_started/tensor_expr_get_started.py index 0ca2243c7c3b..7f1bb6a3d1e5 100644 --- a/tutorials/get_started/tensor_expr_get_started.py +++ b/tutorials/get_started/tensor_expr_get_started.py @@ -210,9 +210,9 @@ # - cc.create_shared calls a compiler (gcc) to create a shared library # from tvm.contrib import cc -from tvm.contrib import util +from tvm.contrib import utils -temp = util.tempdir() +temp = utils.tempdir() fadd.save(temp.relpath("myadd.o")) if tgt == "cuda": fadd.imported_modules[0].save(temp.relpath("myadd.ptx")) diff --git a/tutorials/language/tensorize.py b/tutorials/language/tensorize.py index 601adb8dce46..e91cfe43ab46 100644 --- a/tutorials/language/tensorize.py +++ b/tutorials/language/tensorize.py @@ -160,9 +160,9 @@ def gemv_impl(): return 0; } """ - from tvm.contrib import util, clang + from tvm.contrib import utils, clang - temp = util.tempdir() + temp = utils.tempdir() ll_path = temp.relpath("temp.ll") # Create LLVM ir from c source code ll_code = clang.create_llvm(cc_code, output=ll_path) @@ -182,7 +182,7 @@ def gemv_impl(): # func = tvm.build(s, [A, B, C], target="llvm", name="gemv") -from tvm.topi.util import get_const_tuple +from tvm.topi.utils import get_const_tuple dtype = A.dtype ctx = tvm.context("cpu", 0) @@ -228,9 +228,9 @@ def gemv_impl(): return 0; } """ - from tvm.contrib import util, clang + from tvm.contrib import utils, clang - temp = util.tempdir() + temp = utils.tempdir() ll_path = temp.relpath("temp.ll") # Create LLVM ir from c source code ll_code = clang.create_llvm(cc_code, output=ll_path) diff --git a/tutorials/micro/micro_tflite.py b/tutorials/micro/micro_tflite.py index 6fd2de15288d..293f95cf75c6 100644 --- a/tutorials/micro/micro_tflite.py +++ b/tutorials/micro/micro_tflite.py @@ -98,7 +98,7 @@ import tvm import tvm.micro as micro from tvm.contrib.download import download_testdata -from tvm.contrib import graph_runtime, util +from tvm.contrib import graph_runtime, utils from tvm import relay # %% diff --git a/version.py b/version.py index 461b81a5571b..f3af4202fe6b 100644 --- a/version.py +++ b/version.py @@ -85,7 +85,7 @@ def git_describe_version(): msg = py_str(out) if msg.find("not a git repository") != -1: return __version__, __version__ - logging.warning("git describe error: %", msg) + logging.warning("git describe: %s, use %s", msg, __version__) return __version__, __version__ describe = py_str(out).strip() arr_info = describe.split("-") diff --git a/vta/python/vta/__init__.py b/vta/python/vta/__init__.py index d39f982823f9..d143c4db6884 100644 --- a/vta/python/vta/__init__.py +++ b/vta/python/vta/__init__.py @@ -20,8 +20,6 @@ Besides the compiler toolchain, it also includes utility functions to configure the hardware environment and access remote device through RPC. """ -from __future__ import absolute_import as _abs - import sys from .bitstream import get_bitstream_path, download_bitstream diff --git a/vta/python/vta/testing/__init__.py b/vta/python/vta/testing/__init__.py index fbc50b063fb5..8d294c2f4d22 100644 --- a/vta/python/vta/testing/__init__.py +++ b/vta/python/vta/testing/__init__.py @@ -17,4 +17,4 @@ """Testing utilities, this namespace is not imported by default.""" -from .util import run +from .utils import run diff --git a/vta/python/vta/testing/util.py b/vta/python/vta/testing/utils.py similarity index 100% rename from vta/python/vta/testing/util.py rename to vta/python/vta/testing/utils.py diff --git a/vta/python/vta/top/__init__.py b/vta/python/vta/top/__init__.py index 6f62aff469d4..b9ebe55703c5 100644 --- a/vta/python/vta/top/__init__.py +++ b/vta/python/vta/top/__init__.py @@ -24,4 +24,4 @@ from .vta_conv2d_transpose import conv2d_transpose_packed, schedule_conv2d_transpose_packed from .vta_group_conv2d import group_conv2d_packed, schedule_group_conv2d_packed from .vta_dense import dense_packed, schedule_dense_packed -from . import util +from . import utils diff --git a/vta/python/vta/top/bitpack.py b/vta/python/vta/top/bitpack.py index 52bd13da6c23..50b3729a1e44 100644 --- a/vta/python/vta/top/bitpack.py +++ b/vta/python/vta/top/bitpack.py @@ -21,7 +21,7 @@ import tvm from tvm import te -from tvm.topi import util +from tvm.topi import utils from tvm.relay.op.op import register_compute, register_injective_schedule from tvm.relay.op.op import register_pattern, OpPattern @@ -55,7 +55,7 @@ def bitpack(data, bits, pack_type="int8", name="bitpack"): lanes = data_width // bits # Data must be in multiples of the data_width - assert util.get_const_int(shape_vec[-1]) % lanes == 0, "Not a multiple of word size" + assert utils.get_const_int(shape_vec[-1]) % lanes == 0, "Not a multiple of word size" shape_vec[-1] = shape_vec[-1] // lanes oshape = tuple(shape_vec) diff --git a/vta/python/vta/top/op.py b/vta/python/vta/top/op.py index 27105576f218..f3b808a6d1a0 100644 --- a/vta/python/vta/top/op.py +++ b/vta/python/vta/top/op.py @@ -26,7 +26,7 @@ from tvm.relay.op import strategy as _strategy from tvm.relay.op.op import OpPattern, OpStrategy -from .util import is_packed_layout +from .utils import is_packed_layout from .vta_conv2d import conv2d_packed, schedule_conv2d_packed from .vta_conv2d_transpose import conv2d_transpose_packed, schedule_conv2d_transpose_packed from .vta_group_conv2d import group_conv2d_packed, schedule_group_conv2d_packed @@ -69,7 +69,7 @@ def conv2d_strategy_vta(attrs, inputs, out_type, target): """conv2d vta strategy""" strategy = OpStrategy() kernel = inputs[1] - dilation = topi.util.get_const_tuple(attrs.dilation) + dilation = topi.utils.get_const_tuple(attrs.dilation) groups = attrs.groups layout = attrs.data_layout @@ -102,7 +102,7 @@ def conv2d_strategy_vta(attrs, inputs, out_type, target): @_strategy.conv2d_transpose_strategy.register("vta") def conv2d_transpose_strategy_vta(attrs, inputs, out_type, target): """conv2d_transpose vta strategy""" - dilation = topi.util.get_const_tuple(attrs.dilation) + dilation = topi.utils.get_const_tuple(attrs.dilation) layout = attrs.data_layout assert dilation == (1, 1), "support for dilation limited to (1, 1)" diff --git a/vta/python/vta/top/util.py b/vta/python/vta/top/utils.py similarity index 100% rename from vta/python/vta/top/util.py rename to vta/python/vta/top/utils.py diff --git a/vta/python/vta/top/vta_conv2d.py b/vta/python/vta/top/vta_conv2d.py index e1555654b1e2..0b9cb719189f 100644 --- a/vta/python/vta/top/vta_conv2d.py +++ b/vta/python/vta/top/vta_conv2d.py @@ -23,7 +23,7 @@ from tvm import autotvm from tvm import topi -from .util import is_packed_layout +from .utils import is_packed_layout from ..environment import get_env @@ -40,12 +40,12 @@ def conv2d_packed(cfg, data, kernel, strides, padding, dilation, layout, out_dty pad_data = data assert len(data.shape) == 6 assert len(kernel.shape) == 6 - oheight = topi.util.get_const_int((pad_data.shape[2] - kernel.shape[2]) // strides[0] + 1) - owidth = topi.util.get_const_int((pad_data.shape[3] - kernel.shape[3]) // strides[1] + 1) + oheight = topi.utils.get_const_int((pad_data.shape[2] - kernel.shape[2]) // strides[0] + 1) + owidth = topi.utils.get_const_int((pad_data.shape[3] - kernel.shape[3]) // strides[1] + 1) oshape = (data.shape[0], kernel.shape[0], oheight, owidth, data.shape[4], kernel.shape[4]) - ishape = topi.util.get_const_tuple(data.shape) - kshape = topi.util.get_const_tuple(kernel.shape) + ishape = topi.utils.get_const_tuple(data.shape) + kshape = topi.utils.get_const_tuple(kernel.shape) d_i = te.reduce_axis((0, kshape[2]), name="d_i") d_j = te.reduce_axis((0, kshape[3]), name="d_j") k_o = te.reduce_axis((0, ishape[1]), name="k_o") @@ -64,7 +64,7 @@ def conv2d_packed(cfg, data, kernel, strides, padding, dilation, layout, out_dty cfg.add_flop( 2 - * np.prod(topi.util.get_const_tuple(oshape)) + * np.prod(topi.utils.get_const_tuple(oshape)) * kshape[2] * kshape[3] * ishape[1] diff --git a/vta/python/vta/top/vta_conv2d_transpose.py b/vta/python/vta/top/vta_conv2d_transpose.py index c020747221c5..5a44104baa57 100644 --- a/vta/python/vta/top/vta_conv2d_transpose.py +++ b/vta/python/vta/top/vta_conv2d_transpose.py @@ -22,8 +22,8 @@ from tvm import te from tvm import autotvm from tvm import topi -from tvm.topi.util import get_const_tuple -from tvm.topi.nn.util import get_pad_tuple +from tvm.topi.utils import get_const_tuple +from tvm.topi.nn.utils import get_pad_tuple from ..environment import get_env @@ -75,7 +75,7 @@ def conv2d_transpose_packed(cfg, data, kernel, strides, padding, out_dtype, outp cfg.add_flop( 2 - * np.prod(topi.util.get_const_tuple(oshape)) + * np.prod(topi.utils.get_const_tuple(oshape)) * kshape[2] * kshape[3] * ishape[1] diff --git a/vta/python/vta/top/vta_dense.py b/vta/python/vta/top/vta_dense.py index 4a618f198324..5e06cf9f5624 100644 --- a/vta/python/vta/top/vta_dense.py +++ b/vta/python/vta/top/vta_dense.py @@ -44,8 +44,8 @@ def dense_packed(cfg, data, weight, bias=None, out_dtype=None): raise topi.InvalidShapeError() # Derive shapes - ishape = topi.util.get_const_tuple(data.shape) - wshape = topi.util.get_const_tuple(weight.shape) + ishape = topi.utils.get_const_tuple(data.shape) + wshape = topi.utils.get_const_tuple(weight.shape) oshape = (data.shape[0], weight.shape[0], data.shape[2], weight.shape[2]) # Reduction axes (input channel) @@ -64,7 +64,7 @@ def dense_packed(cfg, data, weight, bias=None, out_dtype=None): tag="dense_pack", ) - cfg.add_flop(2 * np.prod(topi.util.get_const_tuple(oshape)) * ishape[1] * ishape[3]) + cfg.add_flop(2 * np.prod(topi.utils.get_const_tuple(oshape)) * ishape[1] * ishape[3]) return res diff --git a/vta/python/vta/top/vta_group_conv2d.py b/vta/python/vta/top/vta_group_conv2d.py index b2661b38f15c..deb4ea779214 100644 --- a/vta/python/vta/top/vta_group_conv2d.py +++ b/vta/python/vta/top/vta_group_conv2d.py @@ -41,12 +41,12 @@ def group_conv2d_packed(cfg, data, kernel, strides, padding, dilation, group, ou assert kernel.dtype == "int8", kernel.dtype assert out_dtype == "int32", out_dtype - oheight = topi.util.get_const_int((pad_data.shape[2] - kernel.shape[2]) // strides[0] + 1) - owidth = topi.util.get_const_int((pad_data.shape[3] - kernel.shape[3]) // strides[1] + 1) + oheight = topi.utils.get_const_int((pad_data.shape[2] - kernel.shape[2]) // strides[0] + 1) + owidth = topi.utils.get_const_int((pad_data.shape[3] - kernel.shape[3]) // strides[1] + 1) oshape = (data.shape[0], kernel.shape[0], oheight, owidth, data.shape[4], kernel.shape[4]) - ishape = topi.util.get_const_tuple(data.shape) - kshape = topi.util.get_const_tuple(kernel.shape) + ishape = topi.utils.get_const_tuple(data.shape) + kshape = topi.utils.get_const_tuple(kernel.shape) assert group * kshape[1] == ishape[1] assert kshape[0] % group == 0 d_i = te.reduce_axis((0, kshape[2]), name="d_i") @@ -74,7 +74,7 @@ def group_conv2d_packed(cfg, data, kernel, strides, padding, dilation, group, ou cfg.add_flop( 2 - * np.prod(topi.util.get_const_tuple(oshape)) + * np.prod(topi.utils.get_const_tuple(oshape)) * kshape[2] * kshape[3] * ishape[1] diff --git a/vta/python/vta/transform.py b/vta/python/vta/transform.py index ed64ba3dc26c..a485d2cfb7b8 100644 --- a/vta/python/vta/transform.py +++ b/vta/python/vta/transform.py @@ -18,7 +18,7 @@ # pylint: disable=len-as-condition, no-else-return, unused-argument, invalid-name import tvm from tvm import te -from tvm.topi import util +from tvm.topi import utils from .environment import get_env @@ -346,7 +346,7 @@ def _check_compact(buf): ndim = len(buf.shape) size = tvm.tir.const(1, buf.shape[0].dtype) for i in reversed(range(ndim)): - if not util.equal_const_int(size - buf.strides[i], 0): + if not utils.equal_const_int(size - buf.strides[i], 0): raise RuntimeError( "Cannot prove compact: shape=%s, strides=%s" % (buf.shape, buf.strides) ) @@ -357,10 +357,10 @@ def _fold_buffer_dim(buf, scope, elem_block): x_size = 1 base = 0 for i in range(1, ndim + 1): - if not util.equal_const_int(buf.strides[ndim - i] - x_size, 0): + if not utils.equal_const_int(buf.strides[ndim - i] - x_size, 0): raise RuntimeError("scope %s needs to have block=%d" % (scope, elem_block)) x_size = x_size * buf.shape[ndim - i] - if util.equal_const_int(x_size - elem_block, 0): + if utils.equal_const_int(x_size - elem_block, 0): base = i + 1 break if base == 0: @@ -370,7 +370,7 @@ def _fold_buffer_dim(buf, scope, elem_block): shape = [elem_block] strides = [1] - if base < ndim + 1 and not util.equal_const_int(buf.strides[ndim - base], elem_block): + if base < ndim + 1 and not utils.equal_const_int(buf.strides[ndim - base], elem_block): shape.append(1) strides.append(elem_block) @@ -379,14 +379,14 @@ def _fold_buffer_dim(buf, scope, elem_block): x_size = 1 x_stride = buf.strides[ndim - base] next_base = base - if not util.equal_const_int(idxm(x_stride, elem_block), 0): + if not utils.equal_const_int(idxm(x_stride, elem_block), 0): raise RuntimeError( "scope %s need to have block=%d, shape=%s, strides=%s" % (scope, elem_block, buf.shape, buf.strides) ) for i in range(base, ndim + 1): k = ndim - i - if not util.equal_const_int(x_size * x_stride - buf.strides[k], 0): + if not utils.equal_const_int(x_size * x_stride - buf.strides[k], 0): break x_size = x_size * buf.shape[k] next_base = i + 1 @@ -404,7 +404,7 @@ def _get_2d_pattern(buf, elem_width, elem_bytes, dtype, scope, allow_fold): if buf.dtype != dtype: raise RuntimeError("Expect buffer type to be %s instead of %s" % (dtype, buf.dtype)) shape, strides = buf.shape, buf.strides - if not util.equal_const_int(idxm(buf.elem_offset, elem_block), 0): + if not utils.equal_const_int(idxm(buf.elem_offset, elem_block), 0): raise RuntimeError("scope %s need to have block=%d" % (scope, elem_block)) if allow_fold: shape, strides = _fold_buffer_dim(buf, scope, elem_block) @@ -425,10 +425,10 @@ def raise_error(): ndim = len(shape) # Check if the inner-tensor is already flat - flat = util.equal_const_int(shape[-1], elem_block) + flat = utils.equal_const_int(shape[-1], elem_block) if flat: - if not util.equal_const_int(strides[-1], 1): + if not utils.equal_const_int(strides[-1], 1): raise_error() if ndim == 1: @@ -436,7 +436,7 @@ def raise_error(): x_stride = 1 y_size = 1 return x_size, y_size, x_stride, idxd(buf.elem_offset, elem_block) - if not util.equal_const_int(strides[-2] - elem_block, 0): + if not utils.equal_const_int(strides[-2] - elem_block, 0): raise_error() if ndim == 2: @@ -444,7 +444,7 @@ def raise_error(): x_stride = shape[-2] y_size = 1 return x_size, y_size, x_stride, idxd(buf.elem_offset, elem_block) - if not util.equal_const_int(idxm(strides[-3], elem_block), 0): + if not utils.equal_const_int(idxm(strides[-3], elem_block), 0): raise_error() if ndim == 3: @@ -454,11 +454,11 @@ def raise_error(): return x_size, y_size, x_stride, idxd(buf.elem_offset, elem_block) else: - if not util.equal_const_int(strides[-1], 1): + if not utils.equal_const_int(strides[-1], 1): raise_error() - if not util.equal_const_int(strides[-2] - shape[-1], 0): + if not utils.equal_const_int(strides[-2] - shape[-1], 0): raise_error() - if not util.equal_const_int(shape[-1] * shape[-2], elem_block): + if not utils.equal_const_int(shape[-1] * shape[-2], elem_block): raise_error() if ndim == 2: @@ -466,7 +466,7 @@ def raise_error(): x_stride = 1 y_size = 1 return x_size, y_size, x_stride, idxd(buf.elem_offset, elem_block) - if not util.equal_const_int(strides[-3], elem_block): + if not utils.equal_const_int(strides[-3], elem_block): raise_error() if ndim == 3: @@ -474,7 +474,7 @@ def raise_error(): x_stride = shape[-3] y_size = 1 return x_size, y_size, x_stride, idxd(buf.elem_offset, elem_block) - if not util.equal_const_int(idxm(strides[-4], elem_block), 0): + if not utils.equal_const_int(idxm(strides[-4], elem_block), 0): raise_error() if ndim == 4: @@ -556,9 +556,9 @@ def _inject_copy(src, dst, pad_before, pad_after, pad_value): y_pad_after = pad_after[1] x_pad_after = pad_after[2] for dim in range(3, ndim): - if not util.equal_const_int(pad_before[dim], 0): + if not utils.equal_const_int(pad_before[dim], 0): raise ValueError("Do not support pad on the innermost block") - if not util.equal_const_int(pad_after[dim], 0): + if not utils.equal_const_int(pad_after[dim], 0): raise ValueError("Do not support pad on the innermost block") else: y_pad_before = pad_before[0] @@ -566,9 +566,9 @@ def _inject_copy(src, dst, pad_before, pad_after, pad_value): y_pad_after = pad_after[0] x_pad_after = pad_after[1] for dim in range(2, ndim): - if not util.equal_const_int(pad_before[dim], 0): + if not utils.equal_const_int(pad_before[dim], 0): raise ValueError("Do not support pad on the innermost block") - if not util.equal_const_int(pad_after[dim], 0): + if not utils.equal_const_int(pad_after[dim], 0): raise ValueError("Do not support pad on the innermost block") allow_fold = False else: diff --git a/vta/scripts/tune_resnet.py b/vta/scripts/tune_resnet.py index 6d6490448e78..04f430ef8624 100644 --- a/vta/scripts/tune_resnet.py +++ b/vta/scripts/tune_resnet.py @@ -28,7 +28,7 @@ from tvm import rpc, autotvm, relay from tvm.autotvm.measure.measure_methods import request_remote from tvm.autotvm.tuner import XGBTuner, GATuner, RandomTuner, GridSearchTuner -from tvm.contrib import graph_runtime, util, download +from tvm.contrib import graph_runtime, utils, download from tvm.contrib.debugger import debug_runtime import vta from vta.testing import simulator @@ -318,7 +318,7 @@ def tune_tasks( ) # Export library - temp = util.tempdir() + temp = utils.tempdir() lib.save(temp.relpath("graphlib.o")) remote.upload(temp.relpath("graphlib.o")) lib = remote.load_module("graphlib.o") diff --git a/vta/tests/python/integration/test_benchmark_gemm.py b/vta/tests/python/integration/test_benchmark_gemm.py index 432d6f7041ba..3ce2d9c9e4a9 100644 --- a/vta/tests/python/integration/test_benchmark_gemm.py +++ b/vta/tests/python/integration/test_benchmark_gemm.py @@ -18,7 +18,7 @@ import tvm.testing from tvm import te import numpy as np -from tvm.contrib import util +from tvm.contrib import utils import vta.testing from vta.testing import simulator @@ -61,7 +61,7 @@ def run_gemm_packed(env, remote, batch_size, channel, block): def verify(s, check_correctness=True): mod = vta.build(s, [data, weight, res], "ext_dev", env.target_host, name="gemm") - temp = util.tempdir() + temp = utils.tempdir() mod.save(temp.relpath("gemm.o")) remote.upload(temp.relpath("gemm.o")) f = remote.load_module("gemm.o") diff --git a/vta/tests/python/integration/test_benchmark_topi_conv2d.py b/vta/tests/python/integration/test_benchmark_topi_conv2d.py index 004cc6b9c7d3..cad560c208b6 100644 --- a/vta/tests/python/integration/test_benchmark_topi_conv2d.py +++ b/vta/tests/python/integration/test_benchmark_topi_conv2d.py @@ -28,7 +28,7 @@ from tvm import te from tvm import relay from tvm import autotvm -from tvm.contrib import util +from tvm.contrib import utils from tvm.contrib.pickle_memoize import memoize from tvm import topi import tvm.topi.testing @@ -224,13 +224,13 @@ def get_ref_data(): mod = tvm.build( s, [data, kernel, bias, res], target=target, target_host=env.target_host, name="conv2d" ) - temp = util.tempdir() + temp = utils.tempdir() mod.save(temp.relpath("conv2d.o")) remote.upload(temp.relpath("conv2d.o")) f = remote.load_module("conv2d.o") ctx = remote.context(str(target)) - res_np = np.zeros(topi.util.get_const_tuple(res.shape)).astype(res.dtype) + res_np = np.zeros(topi.utils.get_const_tuple(res.shape)).astype(res.dtype) data_arr = tvm.nd.array(data_np, ctx) kernel_arr = tvm.nd.array(kernel_np, ctx) bias_arr = tvm.nd.array(bias_np, ctx) diff --git a/vta/tests/python/integration/test_benchmark_topi_conv2d_transpose.py b/vta/tests/python/integration/test_benchmark_topi_conv2d_transpose.py index 23c4a5c78d90..f750225ed8f7 100644 --- a/vta/tests/python/integration/test_benchmark_topi_conv2d_transpose.py +++ b/vta/tests/python/integration/test_benchmark_topi_conv2d_transpose.py @@ -28,7 +28,7 @@ from tvm import te from tvm import relay from tvm import autotvm -from tvm.contrib import util +from tvm.contrib import utils from tvm.contrib.pickle_memoize import memoize from tvm import topi import tvm.topi.testing @@ -220,13 +220,13 @@ def get_ref_data(): target_host=env.target_host, name="conv2d_transpose", ) - temp = util.tempdir() + temp = utils.tempdir() mod.save(temp.relpath("conv2d_transpose.o")) remote.upload(temp.relpath("conv2d_transpose.o")) f = remote.load_module("conv2d_transpose.o") ctx = remote.context(str(target)) - res_np = np.zeros(topi.util.get_const_tuple(res.shape)).astype(res.dtype) + res_np = np.zeros(topi.utils.get_const_tuple(res.shape)).astype(res.dtype) data_arr = tvm.nd.array(data_np, ctx) kernel_arr = tvm.nd.array(kernel_np, ctx) res_arr = tvm.nd.array(res_np, ctx) diff --git a/vta/tests/python/integration/test_benchmark_topi_dense.py b/vta/tests/python/integration/test_benchmark_topi_dense.py index 37cfac16f5d7..0b604108a35f 100644 --- a/vta/tests/python/integration/test_benchmark_topi_dense.py +++ b/vta/tests/python/integration/test_benchmark_topi_dense.py @@ -26,7 +26,7 @@ import tvm from tvm import te from tvm import autotvm -from tvm.contrib import util +from tvm.contrib import utils from tvm.contrib.pickle_memoize import memoize from tvm import topi import tvm.topi.testing @@ -131,13 +131,13 @@ def get_ref_data(): mod = tvm.build( s, [data, kernel, res], target=target, target_host=env.target_host, name="dense" ) - temp = util.tempdir() + temp = utils.tempdir() mod.save(temp.relpath("dense.o")) remote.upload(temp.relpath("dense.o")) f = remote.load_module("dense.o") ctx = remote.context(str(target)) - res_np = np.zeros(topi.util.get_const_tuple(res.shape)).astype(res.dtype) + res_np = np.zeros(topi.utils.get_const_tuple(res.shape)).astype(res.dtype) data_arr = tvm.nd.array(data_np, ctx) kernel_arr = tvm.nd.array(kernel_np, ctx) res_arr = tvm.nd.array(res_np, ctx) diff --git a/vta/tests/python/integration/test_benchmark_topi_group_conv2d.py b/vta/tests/python/integration/test_benchmark_topi_group_conv2d.py index 08d5e4b52555..da6ba5b8fb94 100644 --- a/vta/tests/python/integration/test_benchmark_topi_group_conv2d.py +++ b/vta/tests/python/integration/test_benchmark_topi_group_conv2d.py @@ -28,7 +28,7 @@ from tvm import te from tvm import relay from tvm import autotvm -from tvm.contrib import util +from tvm.contrib import utils from tvm import topi import tvm.topi.testing import vta @@ -218,13 +218,13 @@ def get_ref_data(): mod = tvm.build( s, [data, kernel, bias, res], target=target, target_host=env.target_host, name="conv2d" ) - temp = util.tempdir() + temp = utils.tempdir() mod.save(temp.relpath("conv2d.o")) remote.upload(temp.relpath("conv2d.o")) f = remote.load_module("conv2d.o") ctx = remote.context(str(target)) - res_np = np.zeros(topi.util.get_const_tuple(res.shape)).astype(res.dtype) + res_np = np.zeros(topi.utils.get_const_tuple(res.shape)).astype(res.dtype) data_arr = tvm.nd.array(data_np, ctx) kernel_arr = tvm.nd.array(kernel_np, ctx) bias_arr = tvm.nd.array(bias_np, ctx) diff --git a/vta/tests/python/unittest/test_vta_insn.py b/vta/tests/python/unittest/test_vta_insn.py index fb0acf1d065f..b83510f4a9dc 100644 --- a/vta/tests/python/unittest/test_vta_insn.py +++ b/vta/tests/python/unittest/test_vta_insn.py @@ -19,7 +19,7 @@ from tvm import te import numpy as np from tvm import topi -from tvm.contrib import util +from tvm.contrib import utils import vta import vta.testing @@ -54,7 +54,7 @@ def _run(env, remote): if not remote: return - temp = util.tempdir() + temp = utils.tempdir() m.save(temp.relpath("load_act.o")) remote.upload(temp.relpath("load_act.o")) f = remote.load_module("load_act.o") @@ -125,7 +125,7 @@ def check_padded_load(pad_before, pad_after, test_name=None): if not remote: return - temp = util.tempdir() + temp = utils.tempdir() mod.save(temp.relpath("padded_load.o")) remote.upload(temp.relpath("padded_load.o")) f = remote.load_module("padded_load.o") @@ -209,7 +209,7 @@ def _run(env, remote): def verify(s, name=None): mod = vta.build(s, [x, w, y], "ext_dev", env.target_host) - temp = util.tempdir() + temp = utils.tempdir() mod.save(temp.relpath("gemm.o")) remote.upload(temp.relpath("gemm.o")) f = remote.load_module("gemm.o") @@ -371,7 +371,7 @@ def check_alu(tvm_op, np_op=None, use_imm=False, test_name=None): mod = vta.build(s, [a, res], "ext_dev", env.target_host) else: mod = vta.build(s, [a, b, res], "ext_dev", env.target_host) - temp = util.tempdir() + temp = utils.tempdir() mod.save(temp.relpath("load_act.o")) remote.upload(temp.relpath("load_act.o")) f = remote.load_module("load_act.o") @@ -454,7 +454,7 @@ def _run(env, remote): mod = vta.build(s, [a, res], "ext_dev", env.target_host) if not remote: return - temp = util.tempdir() + temp = utils.tempdir() mod.save(temp.relpath("load_act.o")) remote.upload(temp.relpath("load_act.o")) f = remote.load_module("load_act.o") @@ -516,7 +516,7 @@ def _run(env, remote): mod = vta.build(s, [a, res], "ext_dev", env.target_host) if not remote: return - temp = util.tempdir() + temp = utils.tempdir() mod.save(temp.relpath("load_act.o")) remote.upload(temp.relpath("load_act.o")) f = remote.load_module("load_act.o") diff --git a/vta/tutorials/autotvm/tune_relay_vta.py b/vta/tutorials/autotvm/tune_relay_vta.py index cb36040f2da4..7f0442402c57 100644 --- a/vta/tutorials/autotvm/tune_relay_vta.py +++ b/vta/tutorials/autotvm/tune_relay_vta.py @@ -62,7 +62,7 @@ import tvm from tvm import te from tvm import rpc, autotvm, relay -from tvm.contrib import graph_runtime, util, download +from tvm.contrib import graph_runtime, utils, download from tvm.autotvm.measure.measure_methods import request_remote from tvm.autotvm.tuner import XGBTuner, GATuner, RandomTuner, GridSearchTuner @@ -424,7 +424,7 @@ def tune_and_evaluate(tuning_opt): # Export library print("Upload...") - temp = util.tempdir() + temp = utils.tempdir() lib.save(temp.relpath("graphlib.o")) remote.upload(temp.relpath("graphlib.o")) lib = remote.load_module("graphlib.o") @@ -507,4 +507,4 @@ def tune_and_evaluate(tuning_opt): # import logging # logging.getLogger('autotvm').setLevel(logging.DEBUG) # -# Finally, always feel free to ask our community for help on https://discuss.tvm.ai +# Finally, always feel free to ask our community for help on https://discuss.tvm.apache.org diff --git a/vta/tutorials/frontend/deploy_classification.py b/vta/tutorials/frontend/deploy_classification.py index 582eb03adc56..1bf4161a3340 100644 --- a/vta/tutorials/frontend/deploy_classification.py +++ b/vta/tutorials/frontend/deploy_classification.py @@ -52,7 +52,7 @@ import tvm from tvm import te from tvm import rpc, autotvm, relay -from tvm.contrib import graph_runtime, util, download +from tvm.contrib import graph_runtime, utils, download from tvm.contrib.debugger import debug_runtime from tvm.relay import transform @@ -204,7 +204,7 @@ print(model + " inference graph built in {0:.2f}s!".format(build_time)) # Send the inference library over to the remote RPC server - temp = util.tempdir() + temp = utils.tempdir() lib.export_library(temp.relpath("graphlib.tar")) remote.upload(temp.relpath("graphlib.tar")) lib = remote.load_module("graphlib.tar") diff --git a/vta/tutorials/frontend/legacy/deploy_detection.py b/vta/tutorials/frontend/legacy/deploy_detection.py index f2c42c1fc1d8..7a4aba93146b 100644 --- a/vta/tutorials/frontend/legacy/deploy_detection.py +++ b/vta/tutorials/frontend/legacy/deploy_detection.py @@ -241,7 +241,7 @@ print(MODEL_NAME + " inference graph built in {0:.2f}s!".format(build_time)) # Send the inference library over to the remote RPC server - temp = util.tempdir() + temp = utils.tempdir() lib.export_library(temp.relpath("graphlib.tar")) remote.upload(temp.relpath("graphlib.tar")) lib = remote.load_module("graphlib.tar") diff --git a/vta/tutorials/matrix_multiply.py b/vta/tutorials/matrix_multiply.py index 71a8f672dbb4..60ea9ca275c1 100644 --- a/vta/tutorials/matrix_multiply.py +++ b/vta/tutorials/matrix_multiply.py @@ -40,7 +40,7 @@ import vta import numpy as np from tvm import rpc -from tvm.contrib import util +from tvm.contrib import utils from vta.testing import simulator # Load VTA parameters from the 3rdparty/vta-hw/config/vta_config.json file @@ -389,7 +389,7 @@ my_gemm = vta.build(s, [A, B, C], "ext_dev", env.target_host, name="my_gemm") # Write the compiled module into an object file. -temp = util.tempdir() +temp = utils.tempdir() my_gemm.save(temp.relpath("gemm.o")) # Send the executable over RPC diff --git a/vta/tutorials/optimize/convolution_opt.py b/vta/tutorials/optimize/convolution_opt.py index 2888f34855f6..e991ffe18f79 100644 --- a/vta/tutorials/optimize/convolution_opt.py +++ b/vta/tutorials/optimize/convolution_opt.py @@ -45,7 +45,7 @@ import numpy as np from tvm import rpc -from tvm.contrib import util +from tvm.contrib import utils from vta.testing import simulator # Load VTA parameters from the 3rdparty/vta-hw/config/vta_config.json file @@ -370,7 +370,7 @@ # Compile the TVM module my_conv = vta.build(s, [data, kernel, res], "ext_dev", env.target_host, name="my_conv") -temp = util.tempdir() +temp = utils.tempdir() my_conv.save(temp.relpath("conv2d.o")) remote.upload(temp.relpath("conv2d.o")) f = remote.load_module("conv2d.o") diff --git a/vta/tutorials/optimize/matrix_multiply_opt.py b/vta/tutorials/optimize/matrix_multiply_opt.py index 8797c3edeffd..44552db21688 100644 --- a/vta/tutorials/optimize/matrix_multiply_opt.py +++ b/vta/tutorials/optimize/matrix_multiply_opt.py @@ -43,7 +43,7 @@ import vta import numpy as np from tvm import rpc -from tvm.contrib import util +from tvm.contrib import utils from vta.testing import simulator # Load VTA parameters from the 3rdparty/vta-hw/config/vta_config.json file @@ -311,7 +311,7 @@ # Compile the TVM module my_gemm = vta.build(s, [data, weight, res], "ext_dev", env.target_host, name="my_gemm") -temp = util.tempdir() +temp = utils.tempdir() my_gemm.save(temp.relpath("gemm.o")) remote.upload(temp.relpath("gemm.o")) f = remote.load_module("gemm.o") diff --git a/vta/tutorials/vta_get_started.py b/vta/tutorials/vta_get_started.py index 8f37b2d10179..16d613581b57 100644 --- a/vta/tutorials/vta_get_started.py +++ b/vta/tutorials/vta_get_started.py @@ -67,7 +67,7 @@ # We'll need the TVM RPC module and the VTA simulator module from tvm import rpc -from tvm.contrib import util +from tvm.contrib import utils from vta.testing import simulator # We read the Pynq RPC host IP address and port number from the OS environment @@ -320,7 +320,7 @@ # execution. # Write the compiled module into an object file. -temp = util.tempdir() +temp = utils.tempdir() my_vadd.save(temp.relpath("vadd.o")) # Send the executable over RPC diff --git a/web/tests/python/webgpu_rpc_test.py b/web/tests/python/webgpu_rpc_test.py index 5de8cf8c72bf..5efc85cf5e32 100644 --- a/web/tests/python/webgpu_rpc_test.py +++ b/web/tests/python/webgpu_rpc_test.py @@ -23,7 +23,7 @@ import tvm from tvm import te from tvm import rpc -from tvm.contrib import util, emcc +from tvm.contrib import utils, emcc import numpy as np proxy_host = "localhost" @@ -50,7 +50,7 @@ def test_rpc(): s[B].bind(xo, te.thread_axis("blockIdx.x")) fadd = tvm.build(s, [A, B], target_device, target_host=target_host, name="addone") - temp = util.tempdir() + temp = utils.tempdir() wasm_path = temp.relpath("addone_gpu.wasm") fadd.export_library(wasm_path, emcc.create_tvmjs_wasm) diff --git a/web/tests/python/websock_rpc_test.py b/web/tests/python/websock_rpc_test.py index 6729964e11d2..48603e86b7f7 100644 --- a/web/tests/python/websock_rpc_test.py +++ b/web/tests/python/websock_rpc_test.py @@ -23,7 +23,7 @@ import tvm from tvm import te from tvm import rpc -from tvm.contrib import util, emcc +from tvm.contrib import utils, emcc import numpy as np proxy_host = "localhost" @@ -43,7 +43,7 @@ def test_rpc(): s = te.create_schedule(B.op) fadd = tvm.build(s, [A, B], target, name="addone") - temp = util.tempdir() + temp = utils.tempdir() wasm_path = temp.relpath("addone.wasm") fadd.export_library(wasm_path, emcc.create_tvmjs_wasm)