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

Method ParseStridedSlice

src/armnnDeserializer/Deserializer.cpp:3123–3166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3121}
3122
3123void IDeserializer::DeserializerImpl::ParseStridedSlice(GraphPtr graph, unsigned int layerIndex)
3124{
3125 CHECK_LAYERS(graph, 0, layerIndex);
3126
3127 TensorRawPtrVector inputs = GetInputs(graph, layerIndex);
3128 CHECK_VALID_SIZE(inputs.size(), 1);
3129
3130 TensorRawPtrVector outputs = GetOutputs(graph, layerIndex);
3131 CHECK_VALID_SIZE(outputs.size(), 1);
3132
3133 auto flatBufferDescriptor = graph->layers()->Get(layerIndex)->layer_as_StridedSliceLayer()->descriptor();
3134
3135 auto flatBufferBegin = flatBufferDescriptor->begin();
3136 auto flatBufferEnd = flatBufferDescriptor->end();
3137 auto flatBufferStride = flatBufferDescriptor->stride();
3138
3139 if (!(flatBufferBegin->size() == flatBufferEnd->size() &&
3140 flatBufferBegin->size() == flatBufferStride->size()))
3141 {
3142 throw ParseException(fmt::format("The size of the begin, end, and stride must be equal {}",
3143 CHECK_LOCATION().AsString()));
3144 }
3145
3146 std::vector<int> begin(flatBufferBegin->begin(), flatBufferBegin->end());
3147 std::vector<int> end(flatBufferEnd->begin(), flatBufferEnd->end());
3148 std::vector<int> stride(flatBufferStride->begin(), flatBufferStride->end());
3149
3150 armnn::StridedSliceDescriptor descriptor(begin, end, stride);
3151 descriptor.m_BeginMask = flatBufferDescriptor->beginMask();
3152 descriptor.m_EndMask = flatBufferDescriptor->endMask();
3153 descriptor.m_ShrinkAxisMask = flatBufferDescriptor->shrinkAxisMask();
3154 descriptor.m_EllipsisMask = flatBufferDescriptor->ellipsisMask();
3155 descriptor.m_NewAxisMask = flatBufferDescriptor->newAxisMask();
3156 descriptor.m_DataLayout = ToDataLayout(flatBufferDescriptor->dataLayout());
3157
3158 auto layerName = GetLayerName(graph, layerIndex);
3159 IConnectableLayer* layer = m_Network->AddStridedSliceLayer(descriptor, layerName.c_str());
3160
3161 armnn::TensorInfo outputTensorInfo = ToTensorInfo(outputs[0]);
3162 layer->GetOutputSlot(0).SetTensorInfo(outputTensorInfo);
3163
3164 RegisterInputSlots(graph, layerIndex, layer);
3165 RegisterOutputSlots(graph, layerIndex, layer);
3166}
3167
3168void IDeserializer::DeserializerImpl::ParseSubtraction(GraphPtr graph, unsigned int layerIndex)
3169{

Callers

nothing calls this directly

Calls 14

ParseExceptionClass · 0.85
formatEnum · 0.85
ToDataLayoutFunction · 0.85
AddStridedSliceLayerMethod · 0.80
GetOutputSlotMethod · 0.80
ToTensorInfoFunction · 0.70
GetLayerNameFunction · 0.50
sizeMethod · 0.45
GetMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
AsStringMethod · 0.45

Tested by

no test coverage detected