MNN/source/backend/cpu/CPUPool.cpp

32 lines
841 B
C++
Raw Normal View History

2019-04-17 10:49:11 +08:00
//
// CPUPool.cpp
// MNN
//
// Created by MNN on 2018/07/15.
// Copyright © 2018, Alibaba Group Holding Limited
//
2019-12-27 22:16:57 +08:00
#include "backend/cpu/CPUPool.hpp"
2020-11-05 16:41:56 +08:00
#include "math/Vec.hpp"
2020-11-05 16:41:56 +08:00
using Vec4 = MNN::Math::Vec<float, 4>;
2021-04-08 15:34:23 +08:00
using Vec16 = MNN::Math::Vec<int8_t, 16>;
2019-04-17 10:49:11 +08:00
namespace MNN {
class CPUPoolCreator : public CPUBackend::Creator {
public:
virtual Execution *onCreate(const std::vector<Tensor *> &inputs, const std::vector<Tensor *> &outputs,
const MNN::Op *op, Backend *backend) const override {
2021-04-08 15:34:23 +08:00
if (inputs[0]->getType() == halide_type_of<int8_t>()) {
return new CPUPool<int8_t, Vec16>(backend, op->main_as_Pool());
}
return new CPUPool<float, Vec4>(backend, op->main_as_Pool());
2019-04-17 10:49:11 +08:00
}
};
REGISTER_CPU_OP_CREATOR(CPUPoolCreator, OpType_Pooling);
2019-12-27 22:16:57 +08:00
2019-04-17 10:49:11 +08:00
} // namespace MNN