2019-04-17 10:49:11 +08:00
|
|
|
//
|
|
|
|
// CPUBinary.hpp
|
|
|
|
// MNN
|
|
|
|
//
|
|
|
|
// Created by MNN on 2018/08/02.
|
|
|
|
// Copyright © 2018, Alibaba Group Holding Limited
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef CPUBinary_hpp
|
|
|
|
#define CPUBinary_hpp
|
|
|
|
|
2019-12-27 22:16:57 +08:00
|
|
|
#include "core/Execution.hpp"
|
2022-09-30 10:02:52 +08:00
|
|
|
#include "backend/cpu/CPURelu.hpp"
|
2021-06-11 17:17:13 +08:00
|
|
|
#include "compute/CommonOptFunction.h"
|
2019-04-17 10:49:11 +08:00
|
|
|
namespace MNN {
|
2021-06-11 17:17:13 +08:00
|
|
|
class CPUBinary : public Execution {
|
2019-04-17 10:49:11 +08:00
|
|
|
public:
|
2022-09-30 10:02:52 +08:00
|
|
|
CPUBinary(Backend *b, MNNBinaryExecute proc, int activationType) : Execution(b) {
|
2021-06-11 17:17:13 +08:00
|
|
|
mProc = proc;
|
2022-09-30 10:02:52 +08:00
|
|
|
mActivationType = activationType;
|
2021-06-11 17:17:13 +08:00
|
|
|
}
|
|
|
|
virtual ~CPUBinary() = default;
|
2019-04-17 10:49:11 +08:00
|
|
|
virtual ErrorCode onResize(const std::vector<Tensor *> &inputs, const std::vector<Tensor *> &outputs) override;
|
|
|
|
virtual ErrorCode onExecute(const std::vector<Tensor *> &inputs, const std::vector<Tensor *> &outputs) override;
|
|
|
|
|
2021-06-11 17:17:13 +08:00
|
|
|
static MNNBinaryExecute selectForFloat(int opType);
|
2022-12-30 15:18:58 +08:00
|
|
|
static MNNBinaryExecute selectForInt(int opType);
|
2021-06-11 17:17:13 +08:00
|
|
|
private:
|
|
|
|
MNNBinaryExecute mProc;
|
|
|
|
int mNeedBroadcastIndex = -1;
|
|
|
|
int mTotalSize;
|
2022-09-30 10:02:52 +08:00
|
|
|
int mActivationType = 0;
|
|
|
|
std::shared_ptr<Execution> mActivationExe;
|
2019-04-17 10:49:11 +08:00
|
|
|
};
|
|
|
|
} // namespace MNN
|
|
|
|
#endif /* CPUBinary_hpp */
|