Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/tvm/auto_scheduler/testing/tune_onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# specific language governing permissions and limitations
# under the License.
# pylint: disable=missing-docstring
from distutils.util import strtobool
import argparse
import json
import os
Expand All @@ -30,6 +29,7 @@
from tvm.meta_schedule.utils import cpu_count
from tvm.relay.frontend import from_onnx
from tvm.support import describe
from tvm.testing.utils import strtobool


def _parse_args():
Expand Down
2 changes: 1 addition & 1 deletion python/tvm/auto_scheduler/testing/tune_relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import argparse
import json
import os
from distutils.util import strtobool

import tvm
from tvm import auto_scheduler
Expand All @@ -29,6 +28,7 @@
from tvm.meta_schedule.testing.tune_utils import create_timer, generate_input_data
from tvm.meta_schedule.utils import cpu_count
from tvm.support import describe
from tvm.testing.utils import strtobool


def _parse_args():
Expand Down
2 changes: 1 addition & 1 deletion python/tvm/auto_scheduler/testing/tune_te.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# specific language governing permissions and limitations
# under the License.
# pylint: disable=missing-docstring
from distutils.util import strtobool
import argparse
import os

Expand All @@ -25,6 +24,7 @@
from tvm.meta_schedule.testing.te_workload import CONFIGS
from tvm.meta_schedule.utils import cpu_count
from tvm.support import describe
from tvm.testing.utils import strtobool


def _parse_args():
Expand Down
2 changes: 1 addition & 1 deletion python/tvm/autotvm/testing/tune_relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import json
import os
import warnings
from distutils.util import strtobool

import tvm
from tvm import autotvm
Expand All @@ -31,6 +30,7 @@
from tvm.meta_schedule.testing.relay_workload import get_network
from tvm.meta_schedule.testing.tune_utils import create_timer, generate_input_data
from tvm.support import describe
from tvm.testing.utils import strtobool


def _parse_args():
Expand Down
2 changes: 1 addition & 1 deletion python/tvm/meta_schedule/testing/tune_onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
import argparse
import json
import logging
from distutils.util import strtobool

import onnx # type: ignore
import tvm
from tvm import meta_schedule as ms
from tvm.meta_schedule.testing.custom_builder_runner import run_module_via_rpc
from tvm.relay.frontend import from_onnx
from tvm.support import describe
from tvm.testing.utils import strtobool

from .tune_utils import create_timer, generate_input_data

Expand Down
2 changes: 1 addition & 1 deletion python/tvm/meta_schedule/testing/tune_relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import argparse
import json
import logging
from distutils.util import strtobool
from typing import Dict

import numpy as np # type: ignore
Expand All @@ -28,6 +27,7 @@
from tvm.meta_schedule.testing.relay_workload import get_network
from tvm.meta_schedule.testing.tune_utils import create_timer, generate_input_data
from tvm.support import describe
from tvm.testing.utils import strtobool


def _parse_args():
Expand Down
2 changes: 1 addition & 1 deletion python/tvm/meta_schedule/testing/tune_te.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
# pylint: disable=missing-docstring
import argparse
import logging
from distutils.util import strtobool
from typing import Optional

import tvm
from tvm import meta_schedule as ms
from tvm import tir
from tvm.meta_schedule.testing.te_workload import create_te_workload
from tvm.support import describe
from tvm.testing.utils import strtobool


def _parse_args():
Expand Down
2 changes: 1 addition & 1 deletion python/tvm/meta_schedule/testing/validate_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import warnings
import itertools
from statistics import mean
from distutils.util import strtobool
from typing import Callable, Tuple, Union, List, Any
import numpy as np # type: ignore

Expand All @@ -35,6 +34,7 @@
from tvm.meta_schedule.utils import remove_build_dir
from tvm.meta_schedule.testing.tune_utils import generate_input_data
from tvm.tir.tensor_intrin import * # type: ignore # pylint: disable=wildcard-import,unused-wildcard-import
from tvm.testing.utils import strtobool

DELIMITOR = "\n" + "-" * 30 + "\n"

Expand Down
15 changes: 15 additions & 0 deletions python/tvm/testing/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1913,6 +1913,21 @@ def skip_parameterizations(*skip_params, reason):
return _mark_parameterizations(*skip_params, marker_fn=pytest.skip, reason=reason)


def strtobool(val):
"""Convert a string representation of truth to true (1) or false (0).
True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values
are 'n', 'no', 'f', 'false', 'off', and '0'. Raises ValueError if
'val' is anything else.
"""
val = val.lower()
if val in ("y", "yes", "t", "true", "on", "1"):
return 1
elif val in ("n", "no", "f", "false", "off", "0"):
return 0
else:
raise ValueError(f"invalid truth value {val!r}")


def main():
test_file = inspect.getsourcefile(sys._getframe(1))
sys.exit(pytest.main([test_file] + sys.argv[1:]))
Expand Down