Skip to content

Commit

Permalink
Make tests into a package
Browse files Browse the repository at this point in the history
Currently, you can't do a relative import of the
test infra because it's not a package. This
adds __init__.py to the test directory to allow for
such imports and also stops finding tests with conflicting
names

Change-Id: I69b17c61239534de148faeb6567d9c8574559564
  • Loading branch information
mbaret authored and manupak committed Sep 14, 2021
1 parent 0523597 commit 7824786
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 8 deletions.
17 changes: 17 additions & 0 deletions tests/python/contrib/test_ethosu/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
"""Test infrastructure for Arm(R) Ethos(TM)-U NPU related tests"""
4 changes: 2 additions & 2 deletions tests/python/contrib/test_ethosu/test_codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
from tvm.relay.backend.contrib.ethosu import util
from tests.python.relay.aot.aot_test_utils import generate_ref_data

import relay_ir_builder
import infra
from . import relay_ir_builder
from . import infra

ACCEL_TYPES = ["ethos-u55-256", "ethos-u55-128", "ethos-u55-64", "ethos-u55-32"]

Expand Down
2 changes: 1 addition & 1 deletion tests/python/contrib/test_ethosu/test_encode_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from tvm.relay.backend.contrib.ethosu.tir.compiler import lower_to_tir
from tvm.relay.backend.contrib.ethosu.tir.scheduler import Convolution2DCompute

from infra import make_ethosu_conv2d
from .infra import make_ethosu_conv2d


# fmt: off
Expand Down
3 changes: 2 additions & 1 deletion tests/python/contrib/test_ethosu/test_legalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
from tvm.relay.backend.contrib.ethosu import legalize, preprocess
from tvm.relay.dataflow_pattern import *
from tvm.relay.op.contrib.ethosu import *
import relay_ir_builder

from . import relay_ir_builder


def test_split_indices_legalize():
Expand Down
2 changes: 1 addition & 1 deletion tests/python/contrib/test_ethosu/test_networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from tvm.relay.backend.contrib.ethosu import util
import tvm.relay.testing.tf as tf_testing

import infra
from . import infra

ACCEL_TYPES = ["ethos-u55-256", "ethos-u55-128", "ethos-u55-64", "ethos-u55-32"]

Expand Down
2 changes: 1 addition & 1 deletion tests/python/contrib/test_ethosu/test_replace_conv2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from tvm.relay.testing import run_opt_pass
from tvm.relay.backend.contrib.ethosu.tir.compiler import lower_to_tir
from tvm.relay.backend.contrib.ethosu.tir.scheduler import total_cascader
from infra import make_ethosu_conv2d, get_convolutional_args
from .infra import make_ethosu_conv2d, get_convolutional_args


@pytest.mark.parametrize(
Expand Down
2 changes: 1 addition & 1 deletion tests/python/contrib/test_ethosu/test_replace_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from tvm.relay.backend.contrib.ethosu.tir.compiler import lower_to_tir
from tvm.relay.backend.contrib.ethosu.tir.scheduler import copy_constants

from infra import make_ethosu_conv2d
from .infra import make_ethosu_conv2d


# fmt: off
Expand Down
2 changes: 1 addition & 1 deletion tests/python/contrib/test_ethosu/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
schedule_cache_reads,
)
from tvm.relay.backend.contrib.ethosu.tir.compiler import lower_to_te, extract_constants
from infra import AttachType, make_ethosu_conv2d
from .infra import AttachType, make_ethosu_conv2d


class TestTEGraph:
Expand Down

0 comments on commit 7824786

Please sign in to comment.