9 const std::vector<const TensorInfo*>& inputs,
10 const std::vector<const TensorInfo*>& outputs,
13 std::string padInputName = std::string(
"input0_");
15 std::string poolOutputName = std::string(
"output0_");
30 std::vector<int> paddings;
35 static_cast<int>(poolDescriptor->
m_PadTop),
37 static_cast<int>(poolDescriptor->
m_PadLeft),
49 static_cast<int>(poolDescriptor->
m_PadTop),
51 static_cast<int>(poolDescriptor->
m_PadLeft),
56 TosaPadAttribute padAttribute(paddings, 0, 0.0f);
57 auto* opPad =
new TosaSerializationOperator(Op_PAD,
58 Attribute_PadAttribute,
63 std::vector<int> pad = {0, 0, 0, 0};
64 std::vector<int> kernel = {
static_cast<int>(poolDescriptor->
m_PoolHeight),
66 std::vector<int> stride = {
static_cast<int>(poolDescriptor->
m_StrideY),
67 static_cast<int>(poolDescriptor->
m_StrideX)};
68 TosaPoolAttribute poolAttribute(pad, kernel, stride, 0, 0,
ArmNNToDType(inputs[0]->GetDataType()));
70 auto* opPool =
new TosaSerializationOperator(Op_AVG_POOL2D,
71 Attribute_PoolAttribute,
76 std::vector<TosaSerializationTensor*> tensors;
79 DType inputDType =
ArmNNToDType(inputs[0]->GetDataType());
84 if(padInputName.find(
"input0_") != std::string::npos)
86 tensors.push_back(
new TosaSerializationTensor(padInputName, inputShape, inputDType, {}));
90 DType outputDType =
ArmNNToDType(outputs[0]->GetDataType());
92 std::vector<int32_t> intermediateShape;
95 intermediateShape = {inputShape[0],
96 inputShape[1] + paddings[2] + paddings[3],
97 inputShape[2] + paddings[4] + paddings[5],
102 intermediateShape = {inputShape[0],
104 inputShape[2] + paddings[4] + paddings[5],
105 inputShape[3] + paddings[6] + paddings[7]};
108 tensors.push_back(
new TosaSerializationTensor(padOutputName, intermediateShape, inputDType, {}));
109 tensors.push_back(
new TosaSerializationTensor(poolOutputName, outputShape, outputDType, {}));
113 return new TosaSerializationBasicBlock(blockName,