aboutsummaryrefslogtreecommitdiff
path: root/src/backends/tosaReference/TosaRefLayerSupport.cpp
diff options
context:
space:
mode:
authorCathal Corbett <cathal.corbett@arm.com>2022-12-07 11:50:50 +0000
committerCathal Corbett <cathal.corbett@arm.com>2022-12-12 20:09:36 +0000
commitb30e6554ad41f21c8326e387aa2c1f8a5d4e6445 (patch)
tree7267ad8027a9eed45348b3808da5fcf901b0b767 /src/backends/tosaReference/TosaRefLayerSupport.cpp
parentec67a0f08e0f96a5aebf3cac65331c67f6649f5e (diff)
downloadarmnn-b30e6554ad41f21c8326e387aa2c1f8a5d4e6445.tar.gz
IVGCVSW-7174 Add Reshape support to TOSA Reference Backend
* Spelling corrections and code refactors added to TosaCommon * TosaDTypeToString() implemented and used in TosaRef IsLayerSupported() instead of enum integer. * Using namespace armnn in TosaCommon OneToOneMappingTests and TosaReference TosaRefLayerSupportTests instead of armnn::ClassName. * Updated VerifyTosaAttribute() to also verify certain attributes from input and output shapes. Signed-off-by: Cathal Corbett <cathal.corbett@arm.com> Change-Id: I71dfca404d081a665f748ab724153c6dc36b7eca
Diffstat (limited to 'src/backends/tosaReference/TosaRefLayerSupport.cpp')
-rw-r--r--src/backends/tosaReference/TosaRefLayerSupport.cpp27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/backends/tosaReference/TosaRefLayerSupport.cpp b/src/backends/tosaReference/TosaRefLayerSupport.cpp
index 848b7efdce..5cda85af20 100644
--- a/src/backends/tosaReference/TosaRefLayerSupport.cpp
+++ b/src/backends/tosaReference/TosaRefLayerSupport.cpp
@@ -36,7 +36,7 @@ static bool RunTosaLayerChecksSingleDataType(TosaSerializationOperator* op,
for (auto input : inputs)
{
- std::string dataTypeCode = std::to_string(input->GetDtype());
+ std::string dataTypeCode = TosaDTypeToString(input->GetDtype());
// Check Dtype from tensor (GetDtype)
supported &= CheckSupportRule(TosaTypeAnyOf(input, supportedTypes),
@@ -54,7 +54,7 @@ static bool RunTosaLayerChecksSingleDataType(TosaSerializationOperator* op,
for (auto output : outputs)
{
- std::string dataTypeCode = std::to_string(output->GetDtype());
+ std::string dataTypeCode = TosaDTypeToString(output->GetDtype());
// Check Dtype from tensor (GetDtype)
supported &= CheckSupportRule(TosaTypeAnyOf(output, supportedTypes),
@@ -97,8 +97,8 @@ static bool RunTosaLayerChecksInputOutputDataType(TosaSerializationOperator* op,
{
auto input = inputs[i];
auto output = outputs[i];
- std::string inputDataTypeCode = std::to_string(input->GetDtype());
- std::string outputDataTypeCode = std::to_string(output->GetDtype());
+ 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)
@@ -285,6 +285,24 @@ static bool IsTosaLayerSupported(TosaSerializationOperator* op,
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);
+ }
default:
SetValueChecked(reasonIfUnsupported, "Operation is currently unsupported by the TOSA Reference Backend.");
return false;
@@ -332,6 +350,7 @@ bool TosaRefLayerSupport::IsLayerSupported(const LayerType& type,
break;
}
case LayerType::Pooling2d:
+ case LayerType::Reshape:
// Setup inputs and outputs
inputInfos.push_back(&infos[0]);
outputInfos.push_back(&infos[1]);