diff options
author | Éanna Ó Catháin <eanna.ocathain@arm.com> | 2018-11-12 11:36:34 +0000 |
---|---|---|
committer | Les Bell <les.bell@arm.com> | 2018-11-12 13:08:37 +0000 |
commit | 4e1e136cce3fca73ba49b570cfcb620f4ec574da (patch) | |
tree | 1fe9fcbb6a9dbafc12aa99ac543bc0da636a1cd1 /src/backends/reference/workloads/RefBatchToSpaceNdUint8Workload.cpp | |
parent | f97debb95cbc7e0bbc60e66e5463ede517cac61b (diff) | |
download | armnn-4e1e136cce3fca73ba49b570cfcb620f4ec574da.tar.gz |
IVGCVSW-2054: BATCH_TO_SPACE_ND Reference implementation and Unit tests.
Change-Id: I13c6728dbb60643d0e086d171225c5d802987f92
Diffstat (limited to 'src/backends/reference/workloads/RefBatchToSpaceNdUint8Workload.cpp')
-rw-r--r-- | src/backends/reference/workloads/RefBatchToSpaceNdUint8Workload.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/backends/reference/workloads/RefBatchToSpaceNdUint8Workload.cpp b/src/backends/reference/workloads/RefBatchToSpaceNdUint8Workload.cpp new file mode 100644 index 0000000000..a66bcd42de --- /dev/null +++ b/src/backends/reference/workloads/RefBatchToSpaceNdUint8Workload.cpp @@ -0,0 +1,30 @@ +// +// Copyright © 2017 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#include "BatchToSpaceNd.hpp" +#include "Profiling.hpp" +#include "RefBatchToSpaceNdUint8Workload.hpp" +#include "RefWorkloadUtils.hpp" + +namespace armnn +{ + +void RefBatchToSpaceNdUint8Workload::Execute() const +{ + ARMNN_SCOPED_PROFILING_EVENT(Compute::CpuRef, "RefBatchToSpaceNdUint8Workload_Execute"); + + const TensorInfo& inputInfo = GetTensorInfo(m_Data.m_Inputs[0]); + const TensorInfo& outputInfo = GetTensorInfo(m_Data.m_Outputs[0]); + auto dequantizedInputData = Dequantize(GetInputTensorDataU8(0, m_Data), inputInfo); + float* outputData = GetOutputTensorDataFloat(0, m_Data); + + std::vector<float> results(outputInfo.GetNumElements()); + BatchToSpaceNd(m_Data.m_Parameters.m_DataLayout, inputInfo, outputInfo, m_Data.m_Parameters.m_BlockShape, + m_Data.m_Parameters.m_Crops, dequantizedInputData.data(), outputData); + + Quantize(GetOutputTensorDataU8(0, m_Data), results.data(), outputInfo); +} + +} //namespace armnn
\ No newline at end of file |