11 #include <boost/numeric/conversion/cast.hpp> 23 const std::string& layerName,
24 unsigned int slotIndex)
30 std::vector<unsigned int> strides(numDims, 0);
31 strides[numDims - 1] = inputShape[numDims - 1];
33 for (
unsigned int i = 2; i <= numDims; i++)
35 strides[numDims - i] = strides[numDims - i + 1] * inputShape[numDims - i];
39 std::cout <<
"\"layerGuid\": " << guid <<
", ";
40 std::cout <<
"\"layerName\": \"" << layerName <<
"\", ";
41 std::cout <<
"\"outputSlot\": " << slotIndex <<
", ";
42 std::cout <<
"\"shape\": ";
45 for (
unsigned int i = 0; i < numDims; i++)
47 std::cout << inputShape[i];
55 std::cout <<
"\"min\": " 56 <<
boost::numeric_cast<
float>(*std::min_element(inputData, inputData + numElements)) <<
", ";
58 std::cout <<
"\"max\": " 59 <<
boost::numeric_cast<
float>(*std::max_element(inputData, inputData + numElements)) <<
", ";
61 std::cout <<
"\"data\": ";
63 for (
unsigned int i = 0; i < numElements; i++)
65 for (
unsigned int j = 0; j < numDims; j++)
67 if (i % strides[j] == 0)
73 std::cout << boost::numeric_cast<float>(inputData[i]);
75 for (
unsigned int j = 0; j < numDims; j++)
77 if ((i+1) % strides[j] == 0)
83 if (i != numElements - 1)
89 std::cout <<
" }" << std::endl;
95 const std::string& layerName,
96 unsigned int slotIndex);
99 const Half* inputData,
101 const std::string& layerName,
102 unsigned int slotIndex);
105 const float* inputData,
107 const std::string& layerName,
108 unsigned int slotIndex);
111 const uint8_t* inputData,
113 const std::string& layerName,
114 unsigned int slotIndex);
117 const int8_t* inputData,
119 const std::string& layerName,
120 unsigned int slotIndex);
123 const int16_t* inputData,
125 const std::string& layerName,
126 unsigned int slotIndex);
129 const int32_t* inputData,
131 const std::string& layerName,
132 unsigned int slotIndex);
const TensorShape & GetShape() const
template void Debug< int8_t >(const TensorInfo &inputInfo, const int8_t *inputData, LayerGuid guid, const std::string &layerName, unsigned int slotIndex)
Copyright (c) 2020 ARM Limited.
template void Debug< BFloat16 >(const TensorInfo &inputInfo, const BFloat16 *inputData, LayerGuid guid, const std::string &layerName, unsigned int slotIndex)
template void Debug< float >(const TensorInfo &inputInfo, const float *inputData, LayerGuid guid, const std::string &layerName, unsigned int slotIndex)
template void Debug< int16_t >(const TensorInfo &inputInfo, const int16_t *inputData, LayerGuid guid, const std::string &layerName, unsigned int slotIndex)
template void Debug< uint8_t >(const TensorInfo &inputInfo, const uint8_t *inputData, LayerGuid guid, const std::string &layerName, unsigned int slotIndex)
void Debug(const TensorInfo &inputInfo, const T *inputData, LayerGuid guid, const std::string &layerName, unsigned int slotIndex)
std::enable_if_t< std::is_unsigned< Source >::value &&std::is_unsigned< Dest >::value, Dest > numeric_cast(Source source)
template void Debug< Half >(const TensorInfo &inputInfo, const Half *inputData, LayerGuid guid, const std::string &layerName, unsigned int slotIndex)
template void Debug< int32_t >(const TensorInfo &inputInfo, const int32_t *inputData, LayerGuid guid, const std::string &layerName, unsigned int slotIndex)
unsigned int GetNumDimensions() const
unsigned int GetNumElements() const