aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadik Armagan <sadik.armagan@arm.com>2018-12-20 14:14:12 +0000
committerSadik Armagan <sadik.armagan@arm.com>2018-12-20 14:14:12 +0000
commit8bef7b3ce1bd7c2356b376c1d69d0eb97e236e06 (patch)
tree3a170918a954b368e6185c13365c3f9059ae3cbe
parenta960bc9d03226a5d2a514f9d7040e5347a2d5c0b (diff)
downloadandroid-nn-driver-8bef7b3ce1bd7c2356b376c1d69d0eb97e236e06.tar.gz
IVGCVSW-1202 SPACE_TO_BATCH_ND integrate Arm Compute CL
* Updated HalPolicy::ConvertSpaceToBatchNd function set the values instead of add. Change-Id: I4b334819c79169fa5949998ffc828ee77c714bc6
-rw-r--r--1.1/HalPolicy.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/1.1/HalPolicy.cpp b/1.1/HalPolicy.cpp
index 86f11188..91cce526 100644
--- a/1.1/HalPolicy.cpp
+++ b/1.1/HalPolicy.cpp
@@ -302,9 +302,6 @@ bool HalPolicy::ConvertSpaceToBatchNd(const Operation& operation, const Model& m
Fail("%s: Only inputs with rank 4 are supported", __func__);
}
- armnn::SpaceToBatchNdDescriptor descriptor;
- descriptor.m_DataLayout = armnn::DataLayout::NHWC;
-
const Operand* blockShapeOperand = GetInputOperand(operation, 1, model);
const Operand* paddingsOperand = GetInputOperand(operation, 2, model);
@@ -316,14 +313,9 @@ bool HalPolicy::ConvertSpaceToBatchNd(const Operation& operation, const Model& m
std::vector<int32_t> blockShape;
GetTensorInt32Values(*blockShapeOperand, blockShape, model, data);
- for (unsigned int i = 0; i < blockShape.size(); i++)
+ if (std::any_of(blockShape.cbegin(), blockShape.cend(), [](int32_t i){ return i < 1; }))
{
- if (blockShape[i] < 1)
- {
- return Fail("%s: Block shape must be at least 1 in all dimensions.", __func__);
- }
-
- descriptor.m_BlockShape.push_back((unsigned int) blockShape[i]);
+ return Fail("%s: Block shape must be at least 1 in all dimensions.", __func__);
}
armnn::TensorShape paddingsOperandShape = GetTensorShapeForOperand(*paddingsOperand);
@@ -332,6 +324,7 @@ bool HalPolicy::ConvertSpaceToBatchNd(const Operation& operation, const Model& m
return Fail("%s: Operation has invalid paddings operand: expected shape [%d, 2]", __func__, spatialDim);
}
+ std::vector<std::pair<unsigned int, unsigned int>> paddingList;
std::vector<int32_t> paddings;
GetTensorInt32Values(*paddingsOperand, paddings, model, data);
for (unsigned int i = 0; i < paddings.size() - 1; i += 2)
@@ -343,9 +336,14 @@ bool HalPolicy::ConvertSpaceToBatchNd(const Operation& operation, const Model& m
return Fail("%s: Operation has invalid paddings operand, invalid padding values.", __func__);
}
- descriptor.m_PadList.emplace_back((unsigned int) paddingBeforeInput, (unsigned int) paddingAfterInput);
+ paddingList.emplace_back((unsigned int) paddingBeforeInput, (unsigned int) paddingAfterInput);
}
+ armnn::SpaceToBatchNdDescriptor descriptor;
+ descriptor.m_DataLayout = armnn::DataLayout::NHWC;
+ descriptor.m_BlockShape.assign(blockShape.cbegin(), blockShape.cend());
+ descriptor.m_PadList.assign(paddingList.cbegin(), paddingList.cend());
+
const Operand* output = GetOutputOperand(operation, 0, model);
if (!output)
{