blob: cc41f1b7c88fb86735f5318c70633b0219f806e8 [file] [log] [blame]
Cathal Corbett9c9d5b92022-08-17 17:30:16 +01001//
2// Copyright © 2022 Arm Ltd and Contributors. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
6#pragma once
7
8#include <Layer.hpp>
9
10#include <tosa_serialization_handler.h>
Cathal Corbettbd18eab2022-11-15 12:56:16 +000011#include "operatorMappings/TosaCommonOperators.hpp"
Cathal Corbett9c9d5b92022-08-17 17:30:16 +010012
13using namespace armnn;
14using namespace tosa;
15
Cathal Corbett9c9d5b92022-08-17 17:30:16 +010016// Populates a tosa::TosaSerializationBasicBlock from constructing
17// tosa::TosaSerializationOperator(s) and tosa::TosaSerializationTensor(s)
18// based on the input armnn::LayerType and associated armnn::TensorInfos and armnn::Descriptor.
19//
Matthew Sloyanc5fe6e72022-11-25 16:10:00 +000020// If an armnn::LayerType does not have a TOSA mapping or the mapping is not implemented in ArmNN,
Cathal Corbett9c9d5b92022-08-17 17:30:16 +010021// an empty tosa::TosaSerializationBasicBlock() is returned with operator tosa::Op_UNKNOWN.
Matthew Sloyanc5fe6e72022-11-25 16:10:00 +000022TosaSerializationBasicBlock* GetTosaMapping(const Layer* layer,
23 const LayerType type,
Cathal Corbett9c9d5b92022-08-17 17:30:16 +010024 const std::vector<const TensorInfo*>& inputs,
25 const std::vector<const TensorInfo*>& outputs,
Matthew Sloyanc5fe6e72022-11-25 16:10:00 +000026 const BaseDescriptor& /*descriptor*/);
Cathal Corbett9c9d5b92022-08-17 17:30:16 +010027
28// Function called in armnn::OptimizeSubgraphView() when access to armnn::Layer is available
Matthew Sloyanc5fe6e72022-11-25 16:10:00 +000029// and there is an option to set TOSA basic block data from constant layer tensors available from the input layer.
30TosaSerializationBasicBlock* GetTosaMappingFromLayer(Layer* layer);