// // Copyright © 2017 Arm Ltd. All rights reserved. // SPDX-License-Identifier: MIT // #pragma once #include "RefWorkloadUtils.hpp" #include #include namespace armnn { template void Merger(const MergerQueueDescriptor& data) { const TensorInfo& outputInfo0 = GetTensorInfo(data.m_Outputs[0]); for (unsigned int index = 0 ; index < outputInfo0.GetNumElements(); ++index) { unsigned int indices[MaxNumOfTensorDimensions] = { 0 }; unsigned int indexRemainder = index; unsigned int dimensionStride = outputInfo0.GetNumElements(); for (unsigned int i=0; i= view.m_Origin[i] + inputInfo.GetShape()[i]) { insideView = false; } } if (insideView) { unsigned int inIndex = 0; unsigned int dimensionStride = 1; for (unsigned int i = inputInfo.GetNumDimensions(); i-- > 0;) { inIndex += dimensionStride * (indices[i] - view.m_Origin[i]); dimensionStride *= inputInfo.GetShape()[i]; } //We are within the view, copy input data to the output corresponding to this view. (GetOutputTensorData(0, data))[index] = (GetInputTensorData(viewIdx, data))[inIndex]; //What should we do if input views overlap on the output tensor? //We could error, take the average, or shm else... //For now just stop after finding first view (input) that matches. break; } } } } } //namespace armnn