MCPcopy Create free account
hub / github.com/ARM-software/armnn / PrintOutputTensors

Method PrintOutputTensors

tests/ExecuteNetwork/ArmNNExecutor.cpp:686–777  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

684}
685
686void ArmNNExecutor::PrintOutputTensors(const armnn::OutputTensors* outputTensors,
687 unsigned int iteration)
688{
689 auto findOutputName = [&](const armnn::LayerBindingId id)
690 {
691 for (auto it = m_IOInfo.m_OutputInfoMap.begin(); it != m_IOInfo.m_OutputInfoMap.end(); ++it)
692 {
693 if (id == it->second.first)
694 {
695 return it->first;
696 }
697 }
698 return std::string{};
699 };
700
701 unsigned int outputIndex = 0;
702 size_t numOutputs = outputTensors->size();
703 for (const auto& output: *outputTensors)
704 {
705 const auto bindingName = findOutputName(output.first);
706 // We've made sure before that the number of output files either equals numOutputs, in which
707 // case we override those files when processing the results of each iteration (only the result
708 // of the last iteration will be stored), or there are enough
709 // output files for each output of each iteration.
710 size_t outputFileIndex = iteration * numOutputs + outputIndex;
711 if (!m_Params.m_OutputTensorFiles.empty())
712 {
713 outputFileIndex = outputFileIndex % m_Params.m_OutputTensorFiles.size();
714 ARMNN_LOG(info) << "Writing output: " << bindingName << " bindingId: '"
715 << output.first
716 << "' of iteration: " << iteration + 1 << " to file: '"
717 << m_Params.m_OutputTensorFiles[outputFileIndex] << "'";
718 }
719
720 const armnn::Optional<std::string> outputTensorFile = m_Params.m_OutputTensorFiles.empty() ?
721 armnn::EmptyOptional() :
722 armnn::MakeOptional<std::string>(
723 m_Params.m_OutputTensorFiles[outputFileIndex]);
724
725 OutputWriteInfo outputWriteInfo
726 {
727 outputTensorFile,
728 bindingName,
729 output.second,
730 !m_Params.m_DontPrintOutputs,
731 output.second.GetDataType()
732 };
733
734 std::cout << bindingName << ": ";
735 std::vector<float> values;
736 switch (output.second.GetDataType())
737 {
738 case armnn::DataType::Float32:
739 {
740 PrintTensor<float>(outputWriteInfo, "%f ");
741 break;
742 }
743

Callers

nothing calls this directly

Calls 7

LogAndThrowFunction · 0.85
emptyMethod · 0.80
EmptyOptionalClass · 0.50
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
GetDataTypeMethod · 0.45

Tested by

no test coverage detected