diff options
author | David Gross <dgross@google.com> | 2020-04-08 11:31:39 -0700 |
---|---|---|
committer | David Gross <dgross@google.com> | 2020-04-08 11:55:26 -0700 |
commit | b5431191e35e1ea5f30ff007902fc7faaaea6a99 (patch) | |
tree | dd5d47f123789a93c162432dac95d0d9fa187727 /nn/runtime | |
parent | 802473f5081d3ab4a36b3296c452554ecbfdf51a (diff) | |
download | ml-b5431191e35e1ea5f30ff007902fc7faaaea6a99.tar.gz |
Add some V1_3 operations to Seed/RandomPartitioningTest.*
Note that this change potentially changes EVERY pseudorandom test case
in this particular test set.
Test: NeuralNetworksTest_static --gtest_filter=Seed/RandomPartitioningTest.*
Also verified that some randomly generated graphs include the
newly-added V1_3 operations.
Bug: 141704808
Change-Id: Ib762c5fe8f7c42825025a6e57b61631040e0911a
Diffstat (limited to 'nn/runtime')
-rw-r--r-- | nn/runtime/test/TestPartitioningRandom.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/nn/runtime/test/TestPartitioningRandom.cpp b/nn/runtime/test/TestPartitioningRandom.cpp index 138f3592c..892cfd405 100644 --- a/nn/runtime/test/TestPartitioningRandom.cpp +++ b/nn/runtime/test/TestPartitioningRandom.cpp @@ -376,6 +376,20 @@ class RandomPartitioningTest : public ::testing::TestWithParam<unsigned> { static const OperationPattern kOperationPatterns[]; // See OperationPattern::mMakeSpecialInput. This function is used to + // manufacture an ELU input operand that doesn't fit the general operand + // pattern known to the graph generator infrastructure. + int makeEluSpecialInput([[maybe_unused]] unsigned problemSize, TestModel* model, + unsigned inputIndex) { + if (inputIndex != 1) { + return -1; + } + + // input operand 1 is alpha, a scalar + const WrapperOperandType alphaType(WrapperType::FLOAT32, {}); + return int(model->addConstantOperand(&alphaType, 1.0f)); + } + + // See OperationPattern::mMakeSpecialInput. This function is used to // manufacture an RNN input operand that doesn't fit the general operand // pattern known to the graph generator infrastructure. int makeRnnSpecialInput(unsigned problemSize, TestModel* model, unsigned inputIndex) { @@ -462,6 +476,10 @@ const RandomPartitioningTest::OperationPattern RandomPartitioningTest::kOperatio {HalVersion::V1_2, ANEURALNETWORKS_MAXIMUM, 2, 1, -1, nullptr}, {HalVersion::V1_2, ANEURALNETWORKS_NEG, 1, 1, -1, nullptr}, {HalVersion::V1_2, ANEURALNETWORKS_SIN, 1, 1, -1, nullptr}, + + {HalVersion::V1_3, ANEURALNETWORKS_ELU, 2, 1, -1, + &RandomPartitioningTest::makeEluSpecialInput}, + {HalVersion::V1_3, ANEURALNETWORKS_HARD_SWISH, 1, 1, -1, nullptr}, }; HalVersion RandomPartitioningTest::getMinHalVersion(ANeuralNetworksOperationType type) { |