Internal test change for Hexagon

PiperOrigin-RevId: 313696314
Change-Id: Ie52c3bea91156e135524bc376d537610bd046461
This commit is contained in:
Jared Duke 2020-05-28 18:06:00 -07:00 committed by TensorFlower Gardener
parent 865127af8a
commit 988f124ddb
4 changed files with 25 additions and 1 deletions

View File

@ -23,6 +23,7 @@ limitations under the License.
namespace tflite { namespace tflite {
using testing::ElementsAreArray; using testing::ElementsAreArray;
namespace {
void GenerateUniformRandomVector(int size, float min, float max, void GenerateUniformRandomVector(int size, float min, float max,
std::minstd_rand* random_engine, std::minstd_rand* random_engine,
std::vector<float>* result) { std::vector<float>* result) {
@ -44,6 +45,7 @@ void GenerateUniformRandomVector(int size, float min, float max,
(*result)[i] = min + (max - min) * random_value_scaled_0_1; (*result)[i] = min + (max - min) * random_value_scaled_0_1;
} }
} }
} // namespace
class ActivationOpModel : public SingleOpModelWithHexagon { class ActivationOpModel : public SingleOpModelWithHexagon {
public: public:

View File

@ -20,6 +20,7 @@ limitations under the License.
namespace tflite { namespace tflite {
using testing::ElementsAreArray; using testing::ElementsAreArray;
namespace {
void GenerateUniformRandomVector(int size, float min, float max, void GenerateUniformRandomVector(int size, float min, float max,
std::minstd_rand* random_engine, std::minstd_rand* random_engine,
std::vector<float>* result) { std::vector<float>* result) {
@ -41,6 +42,7 @@ void GenerateUniformRandomVector(int size, float min, float max,
(*result)[i] = min + (max - min) * random_value_scaled_0_1; (*result)[i] = min + (max - min) * random_value_scaled_0_1;
} }
} }
} // namespace
class QuantizedConcatenationOpModel : public SingleOpModelWithHexagon { class QuantizedConcatenationOpModel : public SingleOpModelWithHexagon {
public: public:

View File

@ -1,9 +1,11 @@
"""Rules for generating unit-tests using hexagon delegates.""" """Rules for generating unit-tests using hexagon delegates."""
load("//tensorflow/lite:special_rules.bzl", "tflite_hexagon_mobile_test")
def hexagon_op_tests( def hexagon_op_tests(
srcs = [], srcs = [],
deps = []): deps = []):
"""Create separate unit test targets for each test file in 'srcs'. """Create both monolithic and individual unit test targets for each test file in 'srcs'.
Args: Args:
srcs: list of test files, separate target will be created for each item in the list. srcs: list of test files, separate target will be created for each item in the list.
@ -23,3 +25,17 @@ def hexagon_op_tests(
"notap", "notap",
], ],
) )
all_ops_test_name = "hexagon_op_tests_all"
native.cc_test(
name = all_ops_test_name,
srcs = srcs,
deps = deps,
linkstatic = 1,
tags = [
"no_oss",
"nobuilder",
"notap",
],
)
tflite_hexagon_mobile_test(all_ops_test_name)

View File

@ -47,3 +47,7 @@ def if_nnapi(supported, not_supported = [], supported_android = None):
clean_dep("//tensorflow:android"): supported_android, clean_dep("//tensorflow:android"): supported_android,
"//conditions:default": supported, "//conditions:default": supported,
}) })
def tflite_hexagon_mobile_test(name):
"""This is a no-op outside of Google."""
pass