9 const std::vector<const TensorInfo*>& inputs,
10 const std::vector<const TensorInfo*>& outputs,
13 std::string padInputName = std::string(
"input_");
15 std::string poolOutputName = std::string(
"output0_");
26 std::vector<int> paddings;
31 static_cast<int>(poolDescriptor->
m_PadTop),
33 static_cast<int>(poolDescriptor->
m_PadLeft),
45 static_cast<int>(poolDescriptor->
m_PadTop),
47 static_cast<int>(poolDescriptor->
m_PadLeft),
52 TosaPadAttribute padAttribute(paddings, 0, 0.0f);
53 auto* opPad =
new TosaSerializationOperator(Op_PAD,
54 Attribute_PadAttribute,
59 std::vector<int> pad = {0, 0, 0, 0};
60 std::vector<int> kernel = {
static_cast<int>(poolDescriptor->
m_PoolHeight),
62 std::vector<int> stride = {
static_cast<int>(poolDescriptor->
m_StrideY),
63 static_cast<int>(poolDescriptor->
m_StrideX)};
64 TosaPoolAttribute poolAttribute(pad, kernel, stride, 0, 0,
ArmNNToDType(inputs[0]->GetDataType()));
66 auto* opPool =
new TosaSerializationOperator(Op_AVG_POOL2D,
67 Attribute_PoolAttribute,
72 std::vector<TosaSerializationTensor*> tensors;
75 DType inputDType =
ArmNNToDType(inputs[0]->GetDataType());
80 if(padInputName.find(
"input_") != std::string::npos)
82 tensors.push_back(
new TosaSerializationTensor(padInputName, inputShape, inputDType, {}));
86 DType outputDType =
ArmNNToDType(outputs[0]->GetDataType());
88 std::vector<int32_t> intermediateShape;
91 intermediateShape = {inputShape[0],
92 inputShape[1] + paddings[2] + paddings[3],
93 inputShape[2] + paddings[4] + paddings[5],
98 intermediateShape = {inputShape[0],
100 inputShape[2] + paddings[4] + paddings[5],
101 inputShape[3] + paddings[6] + paddings[7]};
104 tensors.push_back(
new TosaSerializationTensor(padOutputName, intermediateShape, inputDType, {}));
105 tensors.push_back(
new TosaSerializationTensor(poolOutputName, outputShape, outputDType, {}));
109 return new TosaSerializationBasicBlock(blockName,