/* Lets assume the outPtr is the output pointer for one of the output buffer whose index is outIdx for a given network.
OutElemTemplateType is the type of the output and it can be read from sTIDL_IOBufDesc_t.outElementType, e.g. uint8_t, int16_t etc.
All parameter are for a given output and can be accessed by sTIDL_IOBufDesc_t.<parameter>[outIdx]
Following example is for the output but same format is also applicable for input
*/
OutElemTemplateType outPtrStart = &outPtr[outPadT[outIdx] + outPadL[outIdx]];
int32_t outLinePitch = outWidth[outIdx] + outPadL[outIdx] + outPadR[outIdx];
int32_t outBatchPitch = outChannelPitch[outIdx] * outNumChannels[outIdx];
float32_tidl outputVal;
for ( batchIdx = 0; batchIdx < outNumBatches[outIdx];batchIdx++)
{
for ( channelIdx = 0; channelIdx < outNumChannels[outIdx];channelIdx++)
{
for ( heightIdx = 0; heightIdx < outHeight[outIdx];heightIdx++)
{
for ( widthIdx = 0; widthIdx < outWidth[outIdx];widthIdx++)
{
int32_t outIdx = widthIdx +
(heightIdx * outLinePitch) +
(channelIdx * outChannelPitch[outIdx]) +
(batchIdx * outBatchPitch);
/* Note that this is the final de-quantized output */
outputVal = outPtrStart[outIdx] / outTensorScale[outIdx];
printf("Output Element %f \n", outputVal);
}
}
}
}