9 const std::vector<const TensorInfo*>& inputs,
10 const std::vector<const TensorInfo*>& outputs,
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 inputName = std::string(
"input_");
17 std::string outputName = std::string(
"output0_");
18 std::string blockName = std::string(
"Op_") + poolType + std::string(
"_POOL2D_block_") +
GetUniqueTosaMappingID();
28 DType accType = DType_INT32;
29 DType inputDType0 =
ArmNNToDType(inputs[0]->GetDataType());
30 if (inputDType0 == DType_FP32)
34 else if (inputDType0 == DType_FP16)
39 std::vector<TosaSerializationTensor*> tensors;
40 std::vector<TosaSerializationOperator*> operators;
46 if(inputName.find(
"input_") != std::string::npos)
48 tensors.push_back(
new TosaSerializationTensor(inputName, inputShape0, inputDType0, {}));
52 DType outputDType0 =
ArmNNToDType(outputs[0]->GetDataType());
54 tensors.push_back(
new TosaSerializationTensor(outputName, outputShape0, outputDType0, {}));
56 std::vector<int> pad = {
static_cast<int>(poolDescriptor->
m_PadTop),
58 static_cast<int>(poolDescriptor->
m_PadLeft),
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 std::vector<int> dilation = {1, 1};
78 TosaPoolAttribute attribute(pad, kernel, stride, 0, 0, accType);
80 operators.push_back(
new TosaSerializationOperator(opcode,
81 Attribute_PoolAttribute,
88 return new TosaSerializationBasicBlock(blockName,
std::string GetInputSlicedToItsUsedSize(const std::vector< int32_t > &inputShape, const std::string &inputName, const DataLayout layout, const DType datatype, const std::vector< int32_t > &kernel, const std::vector< int32_t > &pad, const std::vector< int32_t > &stride, const std::vector< int32_t > &dilations, std::vector< TosaSerializationTensor * > &tensors, std::vector< TosaSerializationOperator * > &operators, const bool isPoolingOp=false)