24.02
|
Go to the documentation of this file.
7 #include <common/include/ProfilingGuid.hpp>
26 const std::string& layerName,
27 unsigned int slotIndex,
34 std::vector<unsigned int> strides(numDims, 0);
35 strides[numDims - 1] = inputShape[numDims - 1];
37 for (
unsigned int i = 2; i <= numDims; i++)
39 strides[numDims - i] = strides[numDims - i + 1] * inputShape[numDims - i];
43 os <<
"\"layerGuid\": " << guid <<
", ";
44 os <<
"\"layerName\": \"" << layerName <<
"\", ";
45 os <<
"\"outputSlot\": " << slotIndex <<
", ";
49 for (
unsigned int i = 0; i < numDims; i++)
60 <<
static_cast<float>(*std::min_element(inputData, inputData + numElements)) <<
", ";
63 <<
static_cast<float>(*std::max_element(inputData, inputData + numElements)) <<
", ";
67 for (
unsigned int i = 0; i < numElements; i++)
69 for (
unsigned int j = 0; j < numDims; j++)
71 if (i % strides[j] == 0)
77 os << static_cast<float>(inputData[i]);
79 for (
unsigned int j = 0; j < numDims; j++)
81 if ((i + 1) % strides[j] == 0)
87 if (i != numElements - 1)
93 os <<
" }" << std::endl;
100 const std::string& layerName,
101 unsigned int slotIndex,
106 #if !defined(ARMNN_DISABLE_FILESYSTEM)
107 fs::path tmpDir = fs::temp_directory_path();
108 std::ofstream out(tmpDir.generic_string() +
"/ArmNNIntermediateLayerOutputs/" + layerName +
".numpy");
109 PrintOutput<T>(inputInfo, inputData, guid, layerName, slotIndex, out);
115 PrintOutput<T>(inputInfo, inputData, guid, layerName, slotIndex, std::cout);
120 const BFloat16* inputData,
122 const std::string& layerName,
123 unsigned int slotIndex,
126 template void Debug<Half>(
const TensorInfo& inputInfo,
127 const Half* inputData,
129 const std::string& layerName,
130 unsigned int slotIndex,
134 const float* inputData,
136 const std::string& layerName,
137 unsigned int slotIndex,
141 const uint8_t* inputData,
143 const std::string& layerName,
144 unsigned int slotIndex,
148 const int8_t* inputData,
150 const std::string& layerName,
151 unsigned int slotIndex,
155 const int16_t* inputData,
157 const std::string& layerName,
158 unsigned int slotIndex,
162 const int32_t* inputData,
164 const std::string& layerName,
165 unsigned int slotIndex,
169 const int64_t* inputData,
171 const std::string& layerName,
172 unsigned int slotIndex,
unsigned int GetNumElements() const
void PrintOutput(const TensorInfo &inputInfo, const T *inputData, LayerGuid guid, const std::string &layerName, unsigned int slotIndex, std::ostream &os)
unsigned int GetNumDimensions() const
template void Debug< float >(const TensorInfo &inputInfo, const float *inputData, LayerGuid guid, const std::string &layerName, unsigned int slotIndex, bool outputsToFile)
template void Debug< int32_t >(const TensorInfo &inputInfo, const int32_t *inputData, LayerGuid guid, const std::string &layerName, unsigned int slotIndex, bool outputsToFile)
template void Debug< int8_t >(const TensorInfo &inputInfo, const int8_t *inputData, LayerGuid guid, const std::string &layerName, unsigned int slotIndex, bool outputsToFile)
template void Debug< BFloat16 >(const TensorInfo &inputInfo, const BFloat16 *inputData, LayerGuid guid, const std::string &layerName, unsigned int slotIndex, bool outputsToFile)
template void Debug< Half >(const TensorInfo &inputInfo, const Half *inputData, LayerGuid guid, const std::string &layerName, unsigned int slotIndex, bool outputsToFile)
arm::pipe::ProfilingGuid LayerGuid
Define LayerGuid type.
void Debug(const TensorInfo &inputInfo, const T *inputData, LayerGuid guid, const std::string &layerName, unsigned int slotIndex, bool outputsToFile)
const TensorShape & GetShape() const
Copyright (c) 2021 ARM Limited and Contributors.
template void Debug< int64_t >(const TensorInfo &inputInfo, const int64_t *inputData, LayerGuid guid, const std::string &layerName, unsigned int slotIndex, bool outputsToFile)
template void Debug< int16_t >(const TensorInfo &inputInfo, const int16_t *inputData, LayerGuid guid, const std::string &layerName, unsigned int slotIndex, bool outputsToFile)
template void Debug< uint8_t >(const TensorInfo &inputInfo, const uint8_t *inputData, LayerGuid guid, const std::string &layerName, unsigned int slotIndex, bool outputsToFile)