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

Method ParseStack

src/armnnDeserializer/Deserializer.cpp:3821–3867  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3819}
3820
3821void IDeserializer::DeserializerImpl::ParseStack(GraphPtr graph, unsigned int layerIndex)
3822{
3823 CHECK_LAYERS(graph, 0, layerIndex);
3824 auto inputs = GetInputs(graph, layerIndex);
3825
3826 auto outputs = GetOutputs(graph, layerIndex);
3827 CHECK_VALID_SIZE(outputs.size(), 1);
3828
3829 auto flatBufferDescriptor = graph->layers()->Get(layerIndex)->layer_as_StackLayer()->descriptor();
3830 unsigned int axis = flatBufferDescriptor->axis();
3831 unsigned int numInputs = flatBufferDescriptor->numInputs();
3832 CHECK_VALID_SIZE(inputs.size(), numInputs);
3833
3834 auto flatBufferInputShape = flatBufferDescriptor->inputShape();
3835 std::vector<uint32_t> vectorInputShape(flatBufferInputShape->begin(),
3836 flatBufferInputShape->begin() + flatBufferInputShape->size());
3837
3838 TensorShape inputShape(static_cast<unsigned int>(vectorInputShape.size()), vectorInputShape.data());
3839 armnn::StackDescriptor descriptor(axis, numInputs, inputShape);
3840
3841 for (unsigned int i=0; i<inputs.size(); ++i)
3842 {
3843 armnn::TensorShape inputShape = ToTensorInfo(inputs[i]).GetShape();
3844 if (descriptor.m_InputShape != inputShape)
3845 {
3846 std::stringstream ss;
3847 ss << "Shape of input "
3848 << i
3849 << " "
3850 << inputShape
3851 << " does not equal defined input shape "
3852 << descriptor.m_InputShape
3853 << ": "
3854 << CHECK_LOCATION().AsString();
3855 throw ParseException(ss.str());
3856 }
3857 }
3858
3859 auto layerName = GetLayerName(graph, layerIndex);
3860 IConnectableLayer* layer = m_Network->AddStackLayer(descriptor, layerName.c_str());
3861
3862 armnn::TensorInfo outputTensorInfo = ToTensorInfo(outputs[0]);
3863 layer->GetOutputSlot(0).SetTensorInfo(outputTensorInfo);
3864
3865 RegisterInputSlots(graph, layerIndex, layer);
3866 RegisterOutputSlots(graph, layerIndex, layer);
3867}
3868
3869void IDeserializer::DeserializerImpl::ParseStandIn(GraphPtr graph, unsigned int layerIndex)
3870{

Callers

nothing calls this directly

Calls 14

ParseExceptionClass · 0.85
AddStackLayerMethod · 0.80
GetOutputSlotMethod · 0.80
ToTensorInfoFunction · 0.70
GetLayerNameFunction · 0.50
sizeMethod · 0.45
GetMethod · 0.45
beginMethod · 0.45
dataMethod · 0.45
GetShapeMethod · 0.45
AsStringMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected