| 2435 | } |
| 2436 | |
| 2437 | void TfLiteParserImpl::ParseSpaceToDepth(size_t subgraphIndex, size_t operatorIndex) |
| 2438 | { |
| 2439 | CHECK_MODEL(m_Model, subgraphIndex, operatorIndex); |
| 2440 | |
| 2441 | TfLiteParserImpl::TensorRawPtrVector inputs = GetInputs(m_Model, subgraphIndex, operatorIndex); |
| 2442 | CHECK_VALID_SIZE(inputs.size(), 1); |
| 2443 | TfLiteParserImpl::TensorRawPtrVector outputs = GetOutputs(m_Model, subgraphIndex, operatorIndex); |
| 2444 | CHECK_VALID_SIZE(outputs.size(), 1); |
| 2445 | |
| 2446 | armnn::SpaceToDepthDescriptor descriptor; |
| 2447 | |
| 2448 | const auto& operatorPtr = m_Model->subgraphs[subgraphIndex]->operators[operatorIndex]; |
| 2449 | const auto* options = operatorPtr->builtin_options.AsSpaceToDepthOptions(); |
| 2450 | auto blockSize = options->block_size; |
| 2451 | if (blockSize < 2) |
| 2452 | { |
| 2453 | throw ParseException( |
| 2454 | fmt::format("Operation has invalid block size: {} Block size should be >= 2 {}", |
| 2455 | blockSize, |
| 2456 | CHECK_LOCATION().AsString())); |
| 2457 | } |
| 2458 | descriptor.m_BlockSize = armnn::numeric_cast<uint32_t>(blockSize); |
| 2459 | |
| 2460 | auto layerName = fmt::format("SpaceToDepth:{}:{}", subgraphIndex, operatorIndex); |
| 2461 | IConnectableLayer* layer = m_Network->AddSpaceToDepthLayer(descriptor, layerName.c_str()); |
| 2462 | |
| 2463 | if (!layer) |
| 2464 | { |
| 2465 | throw NullPointerException(fmt::format("Layer {} pointer is null {}", |
| 2466 | operatorIndex, CHECK_LOCATION().AsString())); |
| 2467 | } |
| 2468 | |
| 2469 | TensorInfo outputTensorInfo = OutputTensorInfoFromInputs(subgraphIndex, operatorIndex, layer, 0, {0}); |
| 2470 | layer->GetOutputSlot(0).SetTensorInfo(outputTensorInfo); |
| 2471 | |
| 2472 | auto inputTensorIndexes = AsUnsignedVector(GetInputTensorIds(m_Model, subgraphIndex, operatorIndex)); |
| 2473 | RegisterInputSlots(subgraphIndex, operatorIndex, layer, {inputTensorIndexes[0]}); |
| 2474 | |
| 2475 | auto outputTensorIndexes = AsUnsignedVector(GetOutputTensorIds(m_Model, subgraphIndex, operatorIndex)); |
| 2476 | RegisterOutputSlots(subgraphIndex, operatorIndex, layer, {outputTensorIndexes[0]}); |
| 2477 | } |
| 2478 | |
| 2479 | armnn::TensorInfo TfLiteParserImpl::OutputShapeOfSqueeze(std::vector<uint32_t> squeezeDims, |
| 2480 | const armnn::TensorInfo& inputTensorInfo) |
nothing calls this directly
no test coverage detected