| 3819 | } |
| 3820 | |
| 3821 | void 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 | |
| 3869 | void IDeserializer::DeserializerImpl::ParseStandIn(GraphPtr graph, unsigned int layerIndex) |
| 3870 | { |
nothing calls this directly
no test coverage detected