13 std::string poolType = (poolDescriptor->
m_PoolType == PoolingAlgorithm::Max) ?
"Op_MAX" :
"Op_AVG";
14 Op opcode = (poolDescriptor->
m_PoolType == PoolingAlgorithm::Max) ? Op_MAX_POOL2D : Op_AVG_POOL2D;
16 std::string input0Name = std::string(
"input_");
17 std::string outputName = std::string(
"output0_");
18 std::string blockName = std::string(
"Op_") + poolType + std::string(
"_POOL2D_block_") +
GetUniqueTosaMappingID();
28 std::vector<int> pad = {
static_cast<int>(poolDescriptor->
m_PadTop),
30 static_cast<int>(poolDescriptor->
m_PadLeft),
32 std::vector<int> kernel = {
static_cast<int>(poolDescriptor->
m_PoolHeight),
34 std::vector<int> stride = {
static_cast<int>(poolDescriptor->
m_StrideY),
35 static_cast<int>(poolDescriptor->
m_StrideX)};
37 DType accType = DType_INT32;
38 DType inputDType0 =
ArmNNToDType(inputs[0]->GetDataType());
39 if (inputDType0 == DType_FP32)
43 else if (inputDType0 == DType_FP16)
48 TosaPoolAttribute attribute(pad, kernel, stride, 0, 0, accType);
50 auto* op =
new TosaSerializationOperator(opcode,
51 Attribute_PoolAttribute,
56 std::vector<TosaSerializationTensor*> tensors;
61 if(input0Name.find(
"input_") != std::string::npos)
65 tensors.push_back(
new TosaSerializationTensor(input0Name, inputShape0, inputDType0, {}));
69 DType outputDType0 =
ArmNNToDType(outputs[0]->GetDataType());
71 tensors.push_back(
new TosaSerializationTensor(outputName, outputShape0, outputDType0, {}));
75 return new TosaSerializationBasicBlock(blockName,
std::string GenerateUniqueOutputName(const Layer &layer, uint32_t layerSlot=0)
const std::string mainName
DType ArmNNToDType(const DataType &type)
std::vector< int32_t > GetTosaTensorShape(const TensorShape &shape)
std::string GenerateUniqueInputName(const armnn::InputSlot &slot)
std::string GetUniqueTosaMappingID()
const InputSlot & GetInputSlot(unsigned int index) const override
Get a const input slot handle by slot index.
uint32_t m_PadRight
Padding right value in the width dimension.
PoolingAlgorithm m_PoolType
The pooling algorithm to use (Max. Average, L2).
uint32_t m_PoolHeight
Pooling height value.
uint32_t m_PadTop
Padding top value in the height dimension.
uint32_t m_PoolWidth
Pooling width value.
uint32_t m_PadBottom
Padding bottom value in the height dimension.
uint32_t m_PadLeft
Padding left value in the width dimension.
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.