diff --git a/neuralnetworks/1.2/vts/functional/GeneratedTestsV1_2.cpp b/neuralnetworks/1.2/vts/functional/GeneratedTestsV1_2.cpp index 8481b4d7eb..872fc0b071 100644 --- a/neuralnetworks/1.2/vts/functional/GeneratedTestsV1_2.cpp +++ b/neuralnetworks/1.2/vts/functional/GeneratedTestsV1_2.cpp @@ -44,21 +44,6 @@ std::vector createRequests(const std::vector& exampl // in frameworks/ml/nn/runtime/tests/generated/ #include "vts/V1_2/all_generated_V1_2_vts_tests.cpp" -// Generated from spec/strided_slice_invalid_output_dims.mod.py. -// TODO(b/132155416): Make this part of all_generated_V1_2_vts_tests.cpp. -namespace strided_slice_invalid_output_dims { -#include "generated/strided_slice_invalid_output_dims.example.cpp" -#include "generated/strided_slice_invalid_output_dims.model.cpp" -} // namespace strided_slice_invalid_output_dims - -// TODO(b/132155416): Make this part of all_generated_V1_2_vts_tests.cpp. -TEST_F(ValidationTest, strided_slice_invalid_output_dims) { - const Model model = strided_slice_invalid_output_dims::createTestModel(); - const std::vector requests = - createRequests(strided_slice_invalid_output_dims::get_examples()); - validateFailure(model, requests); -} - } // namespace functional } // namespace vts } // namespace V1_2 diff --git a/neuralnetworks/1.2/vts/functional/generated/strided_slice_invalid_output_dims.example.cpp b/neuralnetworks/1.2/vts/functional/generated/strided_slice_invalid_output_dims.example.cpp deleted file mode 100644 index 064083340c..0000000000 --- a/neuralnetworks/1.2/vts/functional/generated/strided_slice_invalid_output_dims.example.cpp +++ /dev/null @@ -1,116 +0,0 @@ -// clang-format off -// Generated file (from: strided_slice_invalid_output_dims.mod.py). Do not edit -std::vector& get_examples() { -static std::vector examples = { -// Begin of an example -{ -.operands = { -//Input(s) -{ // See tools/test_generator/include/TestHarness.h:MixedTyped - // int -> Dimensions map - .operandDimensions = {{0, {2, 3}}}, - // int -> FLOAT32 map - .float32Operands = {{0, {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f}}}, - // int -> INT32 map - .int32Operands = {}, - // int -> QUANT8_ASYMM map - .quant8AsymmOperands = {}, - // int -> QUANT16_SYMM map - .quant16SymmOperands = {}, - // int -> FLOAT16 map - .float16Operands = {}, - // int -> BOOL8 map - .bool8Operands = {}, - // int -> QUANT8_SYMM_PER_CHANNEL map - .quant8ChannelOperands = {}, - // int -> QUANT16_ASYMM map - .quant16AsymmOperands = {}, - // int -> QUANT8_SYMM map - .quant8SymmOperands = {}, -}, -//Output(s) -{ // See tools/test_generator/include/TestHarness.h:MixedTyped - // int -> Dimensions map - .operandDimensions = {{0, {3}}}, - // int -> FLOAT32 map - .float32Operands = {{0, {1.0f, 2.0f, 3.0f}}}, - // int -> INT32 map - .int32Operands = {}, - // int -> QUANT8_ASYMM map - .quant8AsymmOperands = {}, - // int -> QUANT16_SYMM map - .quant16SymmOperands = {}, - // int -> FLOAT16 map - .float16Operands = {}, - // int -> BOOL8 map - .bool8Operands = {}, - // int -> QUANT8_SYMM_PER_CHANNEL map - .quant8ChannelOperands = {}, - // int -> QUANT16_ASYMM map - .quant16AsymmOperands = {}, - // int -> QUANT8_SYMM map - .quant8SymmOperands = {}, -} -}, -}, // End of an example -}; -return examples; -}; - -std::vector& get_examples_dynamic_output_shape() { -static std::vector examples_dynamic_output_shape = { -// Begin of an example -{ -.operands = { -//Input(s) -{ // See tools/test_generator/include/TestHarness.h:MixedTyped - // int -> Dimensions map - .operandDimensions = {{0, {2, 3}}}, - // int -> FLOAT32 map - .float32Operands = {{0, {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f}}}, - // int -> INT32 map - .int32Operands = {}, - // int -> QUANT8_ASYMM map - .quant8AsymmOperands = {}, - // int -> QUANT16_SYMM map - .quant16SymmOperands = {}, - // int -> FLOAT16 map - .float16Operands = {}, - // int -> BOOL8 map - .bool8Operands = {}, - // int -> QUANT8_SYMM_PER_CHANNEL map - .quant8ChannelOperands = {}, - // int -> QUANT16_ASYMM map - .quant16AsymmOperands = {}, - // int -> QUANT8_SYMM map - .quant8SymmOperands = {}, -}, -//Output(s) -{ // See tools/test_generator/include/TestHarness.h:MixedTyped - // int -> Dimensions map - .operandDimensions = {{0, {3}}}, - // int -> FLOAT32 map - .float32Operands = {{0, {1.0f, 2.0f, 3.0f}}}, - // int -> INT32 map - .int32Operands = {}, - // int -> QUANT8_ASYMM map - .quant8AsymmOperands = {}, - // int -> QUANT16_SYMM map - .quant16SymmOperands = {}, - // int -> FLOAT16 map - .float16Operands = {}, - // int -> BOOL8 map - .bool8Operands = {}, - // int -> QUANT8_SYMM_PER_CHANNEL map - .quant8ChannelOperands = {}, - // int -> QUANT16_ASYMM map - .quant16AsymmOperands = {}, - // int -> QUANT8_SYMM map - .quant8SymmOperands = {}, -} -}, -}, // End of an example -}; -return examples_dynamic_output_shape; -}; - diff --git a/neuralnetworks/1.2/vts/functional/generated/strided_slice_invalid_output_dims.model.cpp b/neuralnetworks/1.2/vts/functional/generated/strided_slice_invalid_output_dims.model.cpp deleted file mode 100644 index 106655aa30..0000000000 --- a/neuralnetworks/1.2/vts/functional/generated/strided_slice_invalid_output_dims.model.cpp +++ /dev/null @@ -1,216 +0,0 @@ -// clang-format off -// Generated file (from: strided_slice_invalid_output_dims.mod.py). Do not edit -// Create the model -Model createTestModel() { - const std::vector operands = { - { - .type = OperandType::TENSOR_FLOAT32, - .dimensions = {2, 3}, - .numberOfConsumers = 1, - .scale = 0.0f, - .zeroPoint = 0, - .lifetime = OperandLifeTime::MODEL_INPUT, - .location = {.poolIndex = 0, .offset = 0, .length = 0}, - }, - { - .type = OperandType::TENSOR_INT32, - .dimensions = {2}, - .numberOfConsumers = 1, - .scale = 0.0f, - .zeroPoint = 0, - .lifetime = OperandLifeTime::CONSTANT_COPY, - .location = {.poolIndex = 0, .offset = 0, .length = 8}, - }, - { - .type = OperandType::TENSOR_INT32, - .dimensions = {2}, - .numberOfConsumers = 1, - .scale = 0.0f, - .zeroPoint = 0, - .lifetime = OperandLifeTime::CONSTANT_COPY, - .location = {.poolIndex = 0, .offset = 8, .length = 8}, - }, - { - .type = OperandType::TENSOR_INT32, - .dimensions = {2}, - .numberOfConsumers = 1, - .scale = 0.0f, - .zeroPoint = 0, - .lifetime = OperandLifeTime::CONSTANT_COPY, - .location = {.poolIndex = 0, .offset = 16, .length = 8}, - }, - { - .type = OperandType::INT32, - .dimensions = {}, - .numberOfConsumers = 1, - .scale = 0.0f, - .zeroPoint = 0, - .lifetime = OperandLifeTime::CONSTANT_COPY, - .location = {.poolIndex = 0, .offset = 24, .length = 4}, - }, - { - .type = OperandType::INT32, - .dimensions = {}, - .numberOfConsumers = 1, - .scale = 0.0f, - .zeroPoint = 0, - .lifetime = OperandLifeTime::CONSTANT_COPY, - .location = {.poolIndex = 0, .offset = 28, .length = 4}, - }, - { - .type = OperandType::INT32, - .dimensions = {}, - .numberOfConsumers = 1, - .scale = 0.0f, - .zeroPoint = 0, - .lifetime = OperandLifeTime::CONSTANT_COPY, - .location = {.poolIndex = 0, .offset = 32, .length = 4}, - }, - { - .type = OperandType::TENSOR_FLOAT32, - .dimensions = {3}, - .numberOfConsumers = 0, - .scale = 0.0f, - .zeroPoint = 0, - .lifetime = OperandLifeTime::MODEL_OUTPUT, - .location = {.poolIndex = 0, .offset = 0, .length = 0}, - } - }; - - const std::vector operations = { - { - .type = OperationType::STRIDED_SLICE, - .inputs = {0, 1, 2, 3, 4, 5, 6}, - .outputs = {7}, - } - }; - - const std::vector inputIndexes = {0}; - const std::vector outputIndexes = {7}; - std::vector operandValues = { - 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 - }; - const std::vector pools = {}; - - return { - .operands = operands, - .operations = operations, - .inputIndexes = inputIndexes, - .outputIndexes = outputIndexes, - .operandValues = operandValues, - .pools = pools, - }; -} - -inline bool is_ignored(int i) { - static std::set ignore = {}; - return ignore.find(i) != ignore.end(); -} - -// Create the model -Model createTestModel_dynamic_output_shape() { - const std::vector operands = { - { - .type = OperandType::TENSOR_FLOAT32, - .dimensions = {2, 3}, - .numberOfConsumers = 1, - .scale = 0.0f, - .zeroPoint = 0, - .lifetime = OperandLifeTime::MODEL_INPUT, - .location = {.poolIndex = 0, .offset = 0, .length = 0}, - }, - { - .type = OperandType::TENSOR_INT32, - .dimensions = {2}, - .numberOfConsumers = 1, - .scale = 0.0f, - .zeroPoint = 0, - .lifetime = OperandLifeTime::CONSTANT_COPY, - .location = {.poolIndex = 0, .offset = 0, .length = 8}, - }, - { - .type = OperandType::TENSOR_INT32, - .dimensions = {2}, - .numberOfConsumers = 1, - .scale = 0.0f, - .zeroPoint = 0, - .lifetime = OperandLifeTime::CONSTANT_COPY, - .location = {.poolIndex = 0, .offset = 8, .length = 8}, - }, - { - .type = OperandType::TENSOR_INT32, - .dimensions = {2}, - .numberOfConsumers = 1, - .scale = 0.0f, - .zeroPoint = 0, - .lifetime = OperandLifeTime::CONSTANT_COPY, - .location = {.poolIndex = 0, .offset = 16, .length = 8}, - }, - { - .type = OperandType::INT32, - .dimensions = {}, - .numberOfConsumers = 1, - .scale = 0.0f, - .zeroPoint = 0, - .lifetime = OperandLifeTime::CONSTANT_COPY, - .location = {.poolIndex = 0, .offset = 24, .length = 4}, - }, - { - .type = OperandType::INT32, - .dimensions = {}, - .numberOfConsumers = 1, - .scale = 0.0f, - .zeroPoint = 0, - .lifetime = OperandLifeTime::CONSTANT_COPY, - .location = {.poolIndex = 0, .offset = 28, .length = 4}, - }, - { - .type = OperandType::INT32, - .dimensions = {}, - .numberOfConsumers = 1, - .scale = 0.0f, - .zeroPoint = 0, - .lifetime = OperandLifeTime::CONSTANT_COPY, - .location = {.poolIndex = 0, .offset = 32, .length = 4}, - }, - { - .type = OperandType::TENSOR_FLOAT32, - .dimensions = {0}, - .numberOfConsumers = 0, - .scale = 0.0f, - .zeroPoint = 0, - .lifetime = OperandLifeTime::MODEL_OUTPUT, - .location = {.poolIndex = 0, .offset = 0, .length = 0}, - } - }; - - const std::vector operations = { - { - .type = OperationType::STRIDED_SLICE, - .inputs = {0, 1, 2, 3, 4, 5, 6}, - .outputs = {7}, - } - }; - - const std::vector inputIndexes = {0}; - const std::vector outputIndexes = {7}; - std::vector operandValues = { - 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 - }; - const std::vector pools = {}; - - return { - .operands = operands, - .operations = operations, - .inputIndexes = inputIndexes, - .outputIndexes = outputIndexes, - .operandValues = operandValues, - .pools = pools, - }; -} - -inline bool is_ignored_dynamic_output_shape(int i) { - static std::set ignore = {}; - return ignore.find(i) != ignore.end(); -} - diff --git a/neuralnetworks/1.2/vts/functional/spec/strided_slice_invalid_output_dims.mod.py b/neuralnetworks/1.2/vts/functional/spec/strided_slice_invalid_output_dims.mod.py deleted file mode 100644 index e8d30f3fb2..0000000000 --- a/neuralnetworks/1.2/vts/functional/spec/strided_slice_invalid_output_dims.mod.py +++ /dev/null @@ -1,43 +0,0 @@ -# -# Copyright (C) 2019 The Android Open Source Project -# -# Licensed 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. -# - -# This test makes sure that executing STRIDED_SLICE results in a failure when -# the output dimensions do not match shrinkAxisMask. -# -# The test generator does not support generating tests resulting in execution -# failure, so the gTest part of this test has been written by hand. -# TODO(b/132155416): Move this under frameworks/ml/nn/runtime/test/specs/V1_2. -# -# Based on strided_slice_float_11.mod.py. - -model = Model() -i1 = Input("input", "TENSOR_FLOAT32", "{2, 3}") -begins = Parameter("begins", "TENSOR_INT32", "{2}", [0, 0]) -# The value "2" below makes the test invalid. See http://b/79856511#comment2. -ends = Parameter("ends", "TENSOR_INT32", "{2}", [2, 3]) -strides = Parameter("strides", "TENSOR_INT32", "{2}", [1, 1]) -beginMask = Int32Scalar("beginMask", 0) -endMask = Int32Scalar("endMask", 0) -shrinkAxisMask = Int32Scalar("shrinkAxisMask", 1) - -output = Output("output", "TENSOR_FLOAT32", "{3}") - -model = model.Operation("STRIDED_SLICE", i1, begins, ends, strides, beginMask, endMask, shrinkAxisMask).To(output) - -Example({ - i1: [1, 2, 3, 4, 5, 6], - output: [1, 2, 3], -})