aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sloyan <matthew.sloyan@arm.com>2022-12-07 19:28:18 +0000
committerMatthew Sloyan <matthew.sloyan@arm.com>2022-12-14 19:57:43 +0000
commit67fd526f8f7c79803d514a6045454049104eced9 (patch)
treec32c6a220b276d246d034ed940c94b37324e40f8
parent404369b13f6e603bba3f01f945672bd89104bab7 (diff)
downloadarmnn-67fd526f8f7c79803d514a6045454049104eced9.tar.gz
Update TOSA Reference Backend IsLayerSupported
* Replace current IsLayerSupported checks with ModelRunner for better validation. * Added options to be able to disable the output from the TOSA Reference Model during layer support. * Updated layer support tests to reflect actual support. Signed-off-by: Matthew Sloyan <matthew.sloyan@arm.com> Change-Id: Iaea17343d0ad51b495477024c44a34d9335d1438
-rw-r--r--cmake/GlobalConfig.cmake5
-rw-r--r--src/backends/tosaCommon/test/OneToOneMappingTests.cpp4
-rw-r--r--src/backends/tosaReference/TosaRefLayerSupport.cpp380
-rw-r--r--src/backends/tosaReference/test/TosaRefLayerSupportTests.cpp79
4 files changed, 60 insertions, 408 deletions
diff --git a/cmake/GlobalConfig.cmake b/cmake/GlobalConfig.cmake
index 5bedee92ea..dd20e15076 100644
--- a/cmake/GlobalConfig.cmake
+++ b/cmake/GlobalConfig.cmake
@@ -26,6 +26,7 @@ option(TF_LITE_GENERATED_PATH "Tensorflow lite generated C++ schema location" OF
option(FLATBUFFERS_ROOT "Location where the flatbuffers 'include' and 'lib' folders to be found" Off)
option(TOSA_SERIALIZATION_LIB_ROOT "Location where the TOSA Serialization Library 'include' and 'lib' folders can be found" OFF)
option(TOSA_REFERENCE_MODEL_ROOT "Location where the TOSA Reference Model 'include' and 'lib' folders can be found" OFF)
+option(TOSA_REFERENCE_MODEL_OUTPUT "TOSA Reference Model output is printed during layer support checks" ON)
option(DYNAMIC_BACKEND_PATHS "Colon seperated list of paths where to load the dynamic backends from" "")
option(SAMPLE_DYNAMIC_BACKEND "Include the sample dynamic backend and its tests in the build" OFF)
option(BUILD_GATORD_MOCK "Build the Gatord simulator for external profiling testing." ON)
@@ -362,6 +363,10 @@ if(ARMNNTOSAREF)
NAMES tosa_reference_model_lib.a tosa_reference_model_lib
HINTS ${TOSA_REFERENCE_MODEL_ROOT}/lib /usr/local/lib /usr/lib)
message(STATUS "TOSA Reference Model set to ${TOSA_REFERENCE_MODEL_LIB}")
+
+ if(TOSA_REFERENCE_MODEL_OUTPUT)
+ add_definitions("-DTOSA_REFERENCE_MODEL_OUTPUT=1")
+ endif()
endif()
# This is the root for the dynamic backend tests to search for dynamic
diff --git a/src/backends/tosaCommon/test/OneToOneMappingTests.cpp b/src/backends/tosaCommon/test/OneToOneMappingTests.cpp
index 07ffae41d1..0d19a328d6 100644
--- a/src/backends/tosaCommon/test/OneToOneMappingTests.cpp
+++ b/src/backends/tosaCommon/test/OneToOneMappingTests.cpp
@@ -384,8 +384,8 @@ TEST_CASE("GetTosaMapping_SliceLayer")
std::vector<std::vector<int32_t>> outputShape = {{ 2, 1, 3 }};
SliceDescriptor descriptor;
- descriptor.m_Begin = { 3 };
- descriptor.m_Size = { 3 };
+ descriptor.m_Begin = { 1, 0, 0 };
+ descriptor.m_Size = { 2, 1, 3 };
TosaSerializationBasicBlock* basicBlock =
GetTosaMapping(nullptr, LayerType::Slice, {&inputInfo}, {&outputInfo}, descriptor);
diff --git a/src/backends/tosaReference/TosaRefLayerSupport.cpp b/src/backends/tosaReference/TosaRefLayerSupport.cpp
index daa27f63dc..928a19c232 100644
--- a/src/backends/tosaReference/TosaRefLayerSupport.cpp
+++ b/src/backends/tosaReference/TosaRefLayerSupport.cpp
@@ -4,329 +4,20 @@
//
#include "TosaRefLayerSupport.hpp"
+
#include <tosaCommon/TosaMappings.hpp>
#include <armnn/Types.hpp>
#include <armnn/utility/IgnoreUnused.hpp>
-#include <tosaCommon/TosaLayerSupportRules.hpp>
-#include <LayerSupportCommon.hpp>
+
+#include <graph_status.h>
+#include <model_runner.h>
#include <vector>
-#include <array>
-#include <tuple>
namespace armnn
{
-static bool RunTosaLayerChecksSingleDataType(TosaSerializationOperator* op,
- const std::vector<TosaSerializationTensor*>& inputs,
- const std::vector<TosaSerializationTensor*>& outputs,
- const std::vector<Attribute>& supportedAttributes,
- const std::vector<DType>& supportedTypes,
- Optional<string&> reasonIfUnsupported)
-{
- bool supported = true;
-
- std::string opString = TosaOpToString(op->GetOp());
-
- // Check Attribute from operator (GetAttribute)
- supported &= CheckSupportRule(TosaOperatorAttributeOfAny(op, supportedAttributes), reasonIfUnsupported,
- std::string("TOSA Reference Operator: " + opString +
- " has an unsupported attribute.").c_str());
-
- for (auto input : inputs)
- {
- std::string dataTypeCode = TosaDTypeToString(input->GetDtype());
-
- // Check Dtype from tensor (GetDtype)
- supported &= CheckSupportRule(TosaTypeAnyOf(input, supportedTypes),
- reasonIfUnsupported,
- std::string("TOSA Reference Operator: " + opString + " for input: " +
- input->GetName() + " has an unsupported data type: " +
- dataTypeCode).c_str());
-
- // Check Shape from tensor (GetShape)
- supported &= CheckSupportRule(TosaTensorNumDimensionsWithinBounds(input),
- reasonIfUnsupported,
- std::string("Tosa Reference Operator: " + opString + " for input: " +
- input->GetName() + " exceeds MaxNumOfTensorDimensions.").c_str());
- }
-
- for (auto output : outputs)
- {
- std::string dataTypeCode = TosaDTypeToString(output->GetDtype());
-
- // Check Dtype from tensor (GetDtype)
- supported &= CheckSupportRule(TosaTypeAnyOf(output, supportedTypes),
- reasonIfUnsupported,
- std::string("TOSA Reference Operator: " + opString + " for output: " +
- output->GetName() + " has an unsupported data type: " +
- dataTypeCode).c_str());
-
- // Check Shape from tensor (GetShape)
- supported &= CheckSupportRule(TosaTensorNumDimensionsWithinBounds(output),
- reasonIfUnsupported,
- std::string("Tosa Reference Operator: " + opString + " for output: " +
- output->GetName() + " exceeds MaxNumOfTensorDimensions.").c_str());
- }
-
- return supported;
-}
-
-static bool RunTosaLayerChecksInputOutputDataType(TosaSerializationOperator* op,
- const std::vector<TosaSerializationTensor*>& inputs,
- const std::vector<TosaSerializationTensor*>& outputs,
- const std::vector<Attribute>& supportedAttributes,
- const std::vector<std::tuple<DType,DType>>& supportedMappingTypes,
- Optional<string&> reasonIfUnsupported)
-{
- bool supported = true;
-
- std::string opString = TosaOpToString(op->GetOp());
-
- // Check Attribute from operator (GetAttribute)
- supported &= CheckSupportRule(TosaOperatorAttributeOfAny(op, supportedAttributes), reasonIfUnsupported,
- std::string("TOSA Reference Operator: " + opString +
- " has an unsupported attribute.").c_str());
-
- supported &= CheckSupportRule(TosaAssertSize(inputs, outputs), reasonIfUnsupported,
- std::string("TOSA Reference Operator: " + opString +
- " must have 1-to-1 mapping of inputs-to-outputs.").c_str());
-
- for (uint32_t i = 0; i < inputs.size(); i++)
- {
- auto input = inputs[i];
- auto output = outputs[i];
- std::string inputDataTypeCode = TosaDTypeToString(input->GetDtype());
- std::string outputDataTypeCode = TosaDTypeToString(output->GetDtype());
- std::tuple<DType, DType> mappingType(input->GetDtype(), output->GetDtype());
-
- // Check Dtype from tensor (GetDtype)
- supported &= CheckSupportRule(TosaContainerContainsTwoTypes(mappingType, supportedMappingTypes),
- reasonIfUnsupported,
- std::string("TOSA Reference Operator: " + opString + " for input: " +
- input->GetName() + " and output: " + output->GetName() +
- " has an unsupported input data type: " + inputDataTypeCode +
- " to output data type: " + outputDataTypeCode).c_str());
-
- // Check Shape from tensor (GetShape)
- supported &= CheckSupportRule(TosaTensorNumDimensionsWithinBounds(input),
- reasonIfUnsupported,
- std::string("Tosa Reference Operator: " + opString + " for input: " +
- input->GetName() + " exceeds MaxNumOfTensorDimensions.").c_str());
-
- // Check Shape from tensor (GetShape)
- supported &= CheckSupportRule(TosaTensorNumDimensionsWithinBounds(output),
- reasonIfUnsupported,
- std::string("Tosa Reference Operator: " + opString + " for output: " +
- output->GetName() + " exceeds MaxNumOfTensorDimensions.").c_str());
- }
-
- return supported;
-}
-
-static bool RunTosaLayerChecksInputWeightsOutputDataType(
- TosaSerializationOperator* op,
- const std::vector<TosaSerializationTensor*>& inputs,
- const std::vector<TosaSerializationTensor*>& outputs,
- const std::vector<Attribute>& supportedAttributes,
- const std::vector<std::tuple<DType, DType, DType>>& supportedMappingTypes,
- Optional<string&> reasonIfUnsupported)
-{
- bool supported = true;
-
- std::string opString = TosaOpToString(op->GetOp());
-
- // Check Attribute from operator (GetAttribute)
- supported &= CheckSupportRule(TosaOperatorAttributeOfAny(op, supportedAttributes), reasonIfUnsupported,
- std::string("TOSA Reference Operator: " + opString +
- " has an unsupported attribute.").c_str());
-
- // Check combination of input, weights and output types.
- // Bias is the same as output type, so it is covered.
- std::tuple<DType, DType, DType> mappingTypes(inputs[0]->GetDtype(), inputs[1]->GetDtype(), outputs[0]->GetDtype());
-
- // Check Dtype from tensor (GetDtype)
- supported &= CheckSupportRule(TosaContainerContainsThreeTypes(mappingTypes, supportedMappingTypes),
- reasonIfUnsupported,
- std::string("TOSA Reference Operator: " + opString + " for input 0: " +
- inputs[0]->GetName() + ", input 1: " + inputs[1]->GetName() +
- " and output: " + outputs[0]->GetName() +
- " has an unsupported input data type combination.").c_str());
-
- for (auto input : inputs)
- {
- // Check Shape from tensor (GetShape)
- supported &= CheckSupportRule(TosaTensorNumDimensionsWithinBounds(input),
- reasonIfUnsupported,
- std::string("Tosa Reference Operator: " + opString + " for input: " +
- input->GetName() + " exceeds MaxNumOfTensorDimensions.").c_str());
- }
-
- for (auto output : outputs)
- {
- // Check Shape from tensor (GetShape)
- supported &= CheckSupportRule(TosaTensorNumDimensionsWithinBounds(output),
- reasonIfUnsupported,
- std::string("Tosa Reference Operator: " + opString + " for output: " +
- output->GetName() + " exceeds MaxNumOfTensorDimensions.").c_str());
- }
-
- return supported;
-}
-
-
-
-static bool IsTosaLayerSupported(TosaSerializationOperator* op,
- const std::vector<TosaSerializationTensor*>& inputs,
- const std::vector<TosaSerializationTensor*>& outputs,
- Optional<string&> reasonIfUnsupported)
-{
- switch(op->GetOp())
- {
- case tosa::Op_ADD:
- {
- std::vector<Attribute> supportedAttributes = { Attribute_NONE };
-
- // Only Int32, Fp32 and Fp16 are currently supported by the TOSA Reference Model.
- std::vector<DType> supportedTypes =
- {
- DType_INT32,
- DType_FP16,
- DType_FP32
- };
-
- // Check the attribute, data types and bounds for inputs and outputs.
- return RunTosaLayerChecksSingleDataType(
- op, inputs, outputs, supportedAttributes, supportedTypes, reasonIfUnsupported);
- }
- case tosa::Op_CONST:
- {
- std::vector<Attribute> supportedAttributes = { Attribute_NONE };
-
- std::vector<DType> supportedTypes =
- {
- DType_FP16,
- DType_FP32,
- DType_UINT8,
- DType_INT8,
- DType_INT16,
- DType_INT32,
- DType_BOOL
- };
-
- // Check the attribute, data types and bounds for inputs and outputs.
- return RunTosaLayerChecksSingleDataType(
- op, inputs, outputs, supportedAttributes, supportedTypes, reasonIfUnsupported);
- }
- case tosa::Op_CONV2D:
- {
- std::vector<Attribute> supportedAttributes = { Attribute_ConvAttribute };
-
- std::vector<std::tuple<DType, DType, DType>> supportedTypesMapping =
- {
- std::tuple<DType, DType, DType>(DType_FP16, DType_FP16, DType_FP16),
- std::tuple<DType, DType, DType>(DType_FP16, DType_FP16, DType_FP32),
- std::tuple<DType, DType, DType>(DType_FP32, DType_FP32, DType_FP32),
- std::tuple<DType, DType, DType>(DType_INT8, DType_INT8, DType_INT32)
- };
-
- return RunTosaLayerChecksInputWeightsOutputDataType(
- op, inputs, outputs, supportedAttributes, supportedTypesMapping, reasonIfUnsupported);
- }
- case tosa::Op_AVG_POOL2D:
- {
- std::vector<Attribute> supportedAttributes = { Attribute_PoolAttribute };
-
- std::vector<std::tuple<DType, DType>> supportedTypesMapping =
- {
- std::tuple<DType, DType>(DType_FP16, DType_FP16),
- std::tuple<DType, DType>(DType_FP16, DType_FP32),
- std::tuple<DType, DType>(DType_FP32, DType_FP32),
- std::tuple<DType, DType>(DType_INT8, DType_INT32),
- std::tuple<DType, DType>(DType_INT16, DType_INT32)
- };
-
- // Check the attribute, data types and bounds for inputs and outputs.
- return RunTosaLayerChecksInputOutputDataType(
- op, inputs, outputs, supportedAttributes, supportedTypesMapping, reasonIfUnsupported);
- }
- case tosa::Op_MAX_POOL2D:
- {
- std::vector<Attribute> supportedAttributes = { Attribute_PoolAttribute };
-
- std::vector<DType> supportedTypes =
- {
- DType_FP16,
- DType_FP32,
- DType_INT8,
- DType_INT16
- };
-
- // Check the attribute, data types and bounds for inputs and outputs.
- return RunTosaLayerChecksSingleDataType(
- op, inputs, outputs, supportedAttributes, supportedTypes, reasonIfUnsupported);
- }
- case tosa::Op_PAD:
- {
- std::vector<Attribute> supportedAttributes = { Attribute_PadAttribute };
-
- std::vector<DType> supportedTypes =
- {
- DType_FP16,
- DType_FP32,
- DType_INT8,
- DType_INT16,
- DType_INT32,
- DType_BOOL
- };
-
- // Check the attribute, data types and bounds for inputs and outputs.
- return RunTosaLayerChecksSingleDataType(
- op, inputs, outputs, supportedAttributes, supportedTypes, reasonIfUnsupported);
- }
- case tosa::Op_RESHAPE:
- {
- std::vector<Attribute> supportedAttributes = { Attribute_ReshapeAttribute };
-
- std::vector<DType> supportedTypes =
- {
- DType_FP16,
- DType_FP32,
- DType_INT8,
- DType_INT16,
- DType_INT32,
- DType_BOOL
- };
-
- // Check the attribute, data types and bounds for inputs and outputs.
- return RunTosaLayerChecksSingleDataType(
- op, inputs, outputs, supportedAttributes, supportedTypes, reasonIfUnsupported);
- }
- case tosa::Op_SLICE:
- {
- std::vector<Attribute> supportedAttributes = { Attribute_SliceAttribute };
-
- std::vector<DType> supportedTypes =
- {
- DType_FP16,
- DType_FP32,
- DType_INT8,
- DType_INT16,
- DType_INT32,
- DType_BOOL
- };
-
- // Check the attribute, data types and bounds for inputs and outputs.
- return RunTosaLayerChecksSingleDataType(
- op, inputs, outputs, supportedAttributes, supportedTypes, reasonIfUnsupported);
- }
- default:
- SetValueChecked(reasonIfUnsupported, "Operation is currently unsupported by the TOSA Reference Backend.");
- return false;
- }
-}
-
bool TosaRefLayerSupport::IsLayerSupported(const LayerType& type,
const std::vector<TensorInfo>& infos,
const BaseDescriptor& descriptor,
@@ -336,6 +27,7 @@ bool TosaRefLayerSupport::IsLayerSupported(const LayerType& type,
{
IgnoreUnused(lstmParamsInfo);
IgnoreUnused(quantizedLstmInputParamsInfo);
+ IgnoreUnused(reasonIfUnsupported);
std::vector<const TensorInfo*> inputInfos;
std::vector<const TensorInfo*> outputInfos;
@@ -385,35 +77,47 @@ bool TosaRefLayerSupport::IsLayerSupported(const LayerType& type,
return false;
}
- // Loop through block and get each tensor and operator
- for (long unsigned int i = 0; i < mappings->GetOperators().size(); ++i)
- {
- // While looping over operators check for op_UNKNOWN which is unsupported
- if (mappings->GetOperators()[i]->GetOp() == tosa::Op_UNKNOWN) { return false; }
+ TosaSerializationHandler handler;
- // Loop over operators and get GetInput/OutputTensorNames, loop over resulting names and
- // use GetTensorByName to pass pointers to tensors on to the IsTosaLayerSupported()
- std::vector<TosaSerializationTensor*> inputTensorsVect;
- for (const auto& name : mappings->GetOperators()[i]->GetInputTensorNames())
- {
- inputTensorsVect.push_back(mappings->GetTensorByName(name));
- }
+ // Add mappings to main block as the TOSA Reference Model requires the graph to be in one block called main.
+ auto* block = new TosaSerializationBasicBlock("main",
+ mappings->GetOperators(),
+ mappings->GetTensors(),
+ mappings->GetInputs(),
+ mappings->GetOutputs());
+ handler.GetBlocks().emplace_back(block);
- std::vector<TosaSerializationTensor*> outputTensorsVect;
- for (const auto& name : mappings->GetOperators()[i]->GetOutputTensorNames())
- {
- outputTensorsVect.push_back(mappings->GetTensorByName(name));
- }
+ GraphStatus status;
+ TosaReference::IModelRunner runner;
- if (!IsTosaLayerSupported(mappings->GetOperators()[i],
- inputTensorsVect,
- outputTensorsVect,
- reasonIfUnsupported))
- {
- return false;
- }
+#if !defined(TOSA_REFERENCE_MODEL_OUTPUT)
+ // There currently isn't a way to disable the output from the TOSA Reference Model, but it does have a file pointer
+ // to write debug output to, so set this to /dev/null (if it exists on the system) to hide the output.
+ func_debug_t funcDebug;
+
+ FILE* file = fopen("/dev/null", "w");
+ funcDebug.func_debug_file = (file == nullptr) ? stderr : file;
+
+ runner.setFuncDebug(funcDebug);
+#endif
+
+ // Initialise the model runner with the TosaSerializationHandler, which runs validation on the mapping.
+ status = runner.initialize(handler);
+
+#if !defined(TOSA_REFERENCE_MODEL_OUTPUT)
+ // Reset FuncDebug as they can persist across multiple IModelRunner instances.
+ funcDebug.func_debug_file = stderr;
+ runner.setFuncDebug(funcDebug);
+#endif
+
+ if(status == GraphStatus::TOSA_ERROR || status == GraphStatus::TOSA_UNPREDICTABLE)
+ {
+ return false;
+ }
+ else
+ {
+ return true;
}
- return true;
}
} // namespace armnn
diff --git a/src/backends/tosaReference/test/TosaRefLayerSupportTests.cpp b/src/backends/tosaReference/test/TosaRefLayerSupportTests.cpp
index a1bab83e72..0d0cd6eefc 100644
--- a/src/backends/tosaReference/test/TosaRefLayerSupportTests.cpp
+++ b/src/backends/tosaReference/test/TosaRefLayerSupportTests.cpp
@@ -20,7 +20,7 @@ TEST_SUITE("TosaRefLayerSupported")
TEST_CASE("IsLayerSupportedTosaReferenceAddition")
{
TensorShape shape0 = {1,1,3,4};
- TensorShape shape1 = {4};
+ TensorShape shape1 = {1,1,3,4};
TensorShape outShape = {1,1,3,4};
TensorInfo in0(shape0, DataType::Float32);
TensorInfo in1(shape1, DataType::Float32);
@@ -59,14 +59,6 @@ TEST_CASE("IsLayerSupportedTosaReferenceAdditionUnsupported")
reasonIfNotSupported);
CHECK(!supported);
- REQUIRE(reasonIfNotSupported.find(
- "TOSA Reference Operator: Op_ADD for input: input0_") != std::string::npos);
- REQUIRE(reasonIfNotSupported.find(
- "TOSA Reference Operator: Op_ADD for input: input1_") != std::string::npos);
- REQUIRE(reasonIfNotSupported.find(
- "TOSA Reference Operator: Op_ADD for output: output0_") != std::string::npos);
- REQUIRE(reasonIfNotSupported.find(
- "has an unsupported data type: DType_UNKNOWN") != std::string::npos);
}
TEST_CASE("IsLayerSupportedTosaReferenceConstant")
@@ -99,10 +91,6 @@ TEST_CASE("IsLayerSupportedTosaReferenceConstantUnsupported")
reasonIfNotSupported);
CHECK(!supported);
- REQUIRE(reasonIfNotSupported.find(
- "TOSA Reference Operator: Op_CONST for output: constant_") != std::string::npos);
- REQUIRE(reasonIfNotSupported.find(
- "has an unsupported data type: DType_UNKNOWN") != std::string::npos);
}
TEST_CASE("IsLayerSupportedTosaReferenceConv2d")
@@ -148,14 +136,6 @@ TEST_CASE("IsLayerSupportedTosaReferenceConv2dUnsupported")
reasonIfNotSupported);
CHECK(!supported);
- REQUIRE(reasonIfNotSupported.find(
- "TOSA Reference Operator: Op_CONV2D for input 0: input0_") != std::string::npos);
- REQUIRE(reasonIfNotSupported.find(
- "input 1: input1_") != std::string::npos);
- REQUIRE(reasonIfNotSupported.find(
- "and output: output0_") != std::string::npos);
- REQUIRE(reasonIfNotSupported.find(
- "has an unsupported input data type combination.") != std::string::npos);
}
TEST_CASE("IsLayerSupportedTosaReferenceMaxPooling2d")
@@ -166,6 +146,12 @@ TEST_CASE("IsLayerSupportedTosaReferenceMaxPooling2d")
TensorInfo out(outShape, DataType::Float32);
Pooling2dDescriptor desc;
+ desc.m_PoolHeight = 1;
+ desc.m_PoolWidth = 1;
+ desc.m_StrideX = 1;
+ desc.m_StrideY = 1;
+ desc.m_PoolType = armnn::PoolingAlgorithm::Max;
+
TosaRefLayerSupport supportChecker;
std::string reasonIfNotSupported;
auto supported = supportChecker.IsLayerSupported(LayerType::Pooling2d,
@@ -186,29 +172,10 @@ TEST_CASE("IsLayerSupportedTosaReferenceAvgPooling2d_IgnoreValue")
TensorInfo out(outShape, DataType::Float32);
Pooling2dDescriptor desc;
- desc.m_PaddingMethod = PaddingMethod::IgnoreValue;
- desc.m_PoolType = PoolingAlgorithm::Average;
-
- TosaRefLayerSupport supportChecker;
- std::string reasonIfNotSupported;
- auto supported = supportChecker.IsLayerSupported(LayerType::Pooling2d,
- {in, out},
- desc,
- EmptyOptional(),
- EmptyOptional(),
- reasonIfNotSupported);
-
- CHECK(supported);
-}
-
-TEST_CASE("IsLayerSupportedTosaReferenceAvgPooling2d_InputOutputDatatypeDifferent")
-{
- TensorShape inShape = {1,1,3,4};
- TensorShape outShape = {1,1,3,4};
- TensorInfo in(inShape, DataType::QAsymmS8);
- TensorInfo out(outShape, DataType::Signed32);
-
- Pooling2dDescriptor desc;
+ desc.m_PoolHeight = 1;
+ desc.m_PoolWidth = 1;
+ desc.m_StrideX = 1;
+ desc.m_StrideY = 1;
desc.m_PaddingMethod = PaddingMethod::IgnoreValue;
desc.m_PoolType = PoolingAlgorithm::Average;
@@ -242,12 +209,6 @@ TEST_CASE("IsLayerSupportedTosaReferenceMaxPooling2dUnsupported")
reasonIfNotSupported);
CHECK(!supported);
- REQUIRE(reasonIfNotSupported.find(
- "TOSA Reference Operator: Op_MAX_POOL2D for input: input0_") != std::string::npos);
- REQUIRE(reasonIfNotSupported.find(
- "TOSA Reference Operator: Op_MAX_POOL2D for output: output0_") != std::string::npos);
- REQUIRE(reasonIfNotSupported.find(
- "has an unsupported data type: DType_UNKNOWN") != std::string::npos);
}
TEST_CASE("IsLayerSupportedTosaReferenceAvgPooling2dUnsupported_InputOutputDatatypeDifferent")
@@ -271,12 +232,6 @@ TEST_CASE("IsLayerSupportedTosaReferenceAvgPooling2dUnsupported_InputOutputDatat
reasonIfNotSupported);
CHECK(!supported);
- REQUIRE(reasonIfNotSupported.find(
- "TOSA Reference Operator: Op_AVG_POOL2D for input: intermediate0_") != std::string::npos);
- REQUIRE(reasonIfNotSupported.find(
- " and output: output0_") != std::string::npos);
- REQUIRE(reasonIfNotSupported.find(
- " has an unsupported input data type: DType_FP32 to output data type: DType_FP16") != std::string::npos);
}
TEST_CASE("IsLayerSupportedTosaReferenceReshape")
@@ -321,12 +276,6 @@ TEST_CASE("IsLayerSupportedTosaReferenceReshapeUnsupported")
reasonIfNotSupported);
CHECK(!supported);
- REQUIRE(reasonIfNotSupported.find(
- "TOSA Reference Operator: Op_RESHAPE for input: input0_") != std::string::npos);
- REQUIRE(reasonIfNotSupported.find(
- "TOSA Reference Operator: Op_RESHAPE for output: output0_") != std::string::npos);
- REQUIRE(reasonIfNotSupported.find(
- "has an unsupported data type: DType_UNKNOWN") != std::string::npos);
}
TEST_CASE("IsLayerSupportedTosaReferenceSlice")
@@ -373,12 +322,6 @@ TEST_CASE("IsLayerSupportedTosaReferenceSliceUnsupported")
reasonIfNotSupported);
CHECK(!supported);
- REQUIRE(reasonIfNotSupported.find(
- "TOSA Reference Operator: Op_SLICE for input: input0_") != std::string::npos);
- REQUIRE(reasonIfNotSupported.find(
- "TOSA Reference Operator: Op_SLICE for output: output0_") != std::string::npos);
- REQUIRE(reasonIfNotSupported.find(
- "has an unsupported data type: DType_UNKNOWN") != std::string::npos);
}
}