| 66 | } |
| 67 | |
| 68 | Status Graph::Print(bool extended) const |
| 69 | { |
| 70 | if (m_Layers.empty()) |
| 71 | { |
| 72 | ARMNN_LOG(info) << "\n Graph is empty.\n"; |
| 73 | return Status::Success; |
| 74 | } |
| 75 | ARMNN_LOG(info) << "\n"; |
| 76 | ARMNN_LOG(info) << "Walking Pattern: \n"; |
| 77 | |
| 78 | for (auto&& it : TopologicalSort()) |
| 79 | { |
| 80 | auto numInputSlots = it->GetNumInputSlots(); |
| 81 | auto numOutputSlots = it->GetNumOutputSlots(); |
| 82 | |
| 83 | std::string guid; |
| 84 | if (extended) |
| 85 | { |
| 86 | guid += ":"; |
| 87 | guid += std::to_string(it->GetGuid()); |
| 88 | } |
| 89 | ARMNN_LOG(info) << it->GetName() << ":" << GetLayerTypeAsCString(it->GetType()) |
| 90 | << ":" << it->GetBackendId().Get() |
| 91 | << guid |
| 92 | << " has " << numInputSlots << " input slots" |
| 93 | << " and " << numOutputSlots << " output slots."; |
| 94 | |
| 95 | for (auto i : it->GetInputSlots()) |
| 96 | { |
| 97 | std::ostringstream message; |
| 98 | auto inputTensorShape = i.GetConnectedOutputSlot()->GetTensorInfo().GetShape(); |
| 99 | unsigned int numDims = inputTensorShape.GetNumDimensions(); |
| 100 | |
| 101 | message << "The input slot has shape [ "; |
| 102 | for (unsigned int dim=0; dim < numDims; dim++) |
| 103 | { |
| 104 | message << inputTensorShape[dim] << ","; |
| 105 | } |
| 106 | message << " ]"; |
| 107 | if (extended) |
| 108 | { |
| 109 | message << " Scale: " << i.GetConnectedOutputSlot()->GetTensorInfo().GetQuantizationScale(); |
| 110 | message << " Offset: " << i.GetConnectedOutputSlot()->GetTensorInfo().GetQuantizationOffset(); |
| 111 | message << " The input slot is connected to: "; |
| 112 | message << i.GetConnectedOutputSlot()->GetOwningIConnectableLayer().GetGuid(); |
| 113 | } |
| 114 | ARMNN_LOG(info) << message.str(); |
| 115 | } |
| 116 | |
| 117 | for (unsigned int i = 0; i < it->GetNumOutputSlots(); i++) |
| 118 | { |
| 119 | const armnn::Layer *layer = it; |
| 120 | std::ostringstream message; |
| 121 | auto outputTensorShape = layer->GetOutputSlots()[i].GetTensorInfo().GetShape(); |
| 122 | unsigned int numDims = outputTensorShape.GetNumDimensions(); |
| 123 | |
| 124 | message << "The output slot has shape [ "; |
| 125 | for (unsigned int dim=0; dim < numDims; dim++) |