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

Method SerializeToDot

src/armnn/Graph.cpp:146–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144}
145
146Status Graph::SerializeToDot(std::ostream& stream)
147{
148 {
149 DotGraph graph(stream, "Optimized");
150
151 {
152 // Default node attributes:
153 DotDefaults nodes(stream, "node");
154 nodes.GetAttributeSet()
155 .AddAttribute("shape", "record");
156 }
157
158 {
159 // Default edge attributes:
160 DotDefaults edges(stream, "edge");
161 edges.GetAttributeSet()
162 .AddAttribute("fontsize", 8)
163 .AddAttribute("fontcolor", "blue")
164 .AddAttribute("fontname", "arial-bold");
165 }
166
167 // First declares the nodes.
168 for (auto&& layer : m_Layers)
169 {
170 DotNode node(stream, layer->GetGuid(), GetLayerTypeAsCString(layer->GetType()));
171 // Extracts the layer parameters.
172 ParameterStringifyFunction extractParams = [&node](const std::string & name, const std::string & value){
173 node.GetContents().AddContent(name + " : " + value);
174 };
175 layer->SerializeLayerParameters(extractParams);
176 }
177
178 // Second declares the edges.
179 for (auto&& layer : m_Layers)
180 {
181 LayerGuid toId = layer->GetGuid();
182
183 for (unsigned int i=0;i<layer->GetNumInputSlots(); i++)
184 {
185 OutputSlot* outputSlot = static_cast<OutputSlot*>(layer->GetInputSlot(i).GetConnection());
186 LayerGuid fromId = outputSlot->GetOwningLayer().GetGuid();
187 DotEdge edge(stream, fromId, toId);
188
189 // Now print the tensor shape on the edge.
190 {
191 // Constructs the label attribute with HTML markup.
192 std::stringstream ss;
193 ss << "< " << outputSlot->GetTensorInfo().GetShape() << " >";
194 edge.GetAttributeSet().AddAttribute("label", ss);
195 }
196 }
197 }
198 }
199
200 if (stream.bad())
201 {
202 return Status::Failure;
203 }

Callers 8

CreateMethod · 0.45
CreateMethod · 0.45
InferenceModelMethod · 0.45
OptimizeNetworkMethod · 0.45
LoadModelFunction · 0.45

Calls 8

GetLayerTypeAsCStringFunction · 0.85
AddAttributeMethod · 0.80
GetConnectionMethod · 0.60
GetGuidMethod · 0.45
GetTypeMethod · 0.45
GetNumInputSlotsMethod · 0.45
GetShapeMethod · 0.45

Tested by

no test coverage detected