2020-11-05 16:41:56 +08:00
|
|
|
//
|
|
|
|
// CPURaster.hpp
|
|
|
|
// MNN
|
|
|
|
//
|
|
|
|
// Created by MNN on b'2020/04/02'.
|
|
|
|
// Copyright © 2018, Alibaba Group Holding Limited
|
|
|
|
//
|
|
|
|
#ifndef CPURaster_hpp
|
|
|
|
#define CPURaster_hpp
|
|
|
|
#include "CPUBackend.hpp"
|
|
|
|
#include <map>
|
|
|
|
#include "core/TensorUtils.hpp"
|
|
|
|
namespace MNN {
|
|
|
|
class CPURaster : public Execution {
|
|
|
|
public:
|
2021-06-11 17:17:13 +08:00
|
|
|
CPURaster(Backend* bn) : Execution(bn) {
|
|
|
|
// Do nothing
|
2020-11-05 16:41:56 +08:00
|
|
|
}
|
|
|
|
virtual ~ CPURaster() {
|
|
|
|
// Do nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
void executeFaster(const std::vector<Tensor *> &inputs, const std::vector<Tensor *> &outputs) const;
|
2021-04-08 15:34:23 +08:00
|
|
|
void tensorConvert(Tensor* input, Tensor* output, int bytes);
|
2020-11-05 16:41:56 +08:00
|
|
|
private:
|
|
|
|
std::map<Tensor*, std::shared_ptr<Tensor>> mTempInput;
|
|
|
|
std::vector<std::pair<void*, Tensor::InsideDescribe::Region*>> mTempInputCopy;
|
|
|
|
std::vector<std::pair<void*, Tensor::InsideDescribe::Region>> mFastBlit;
|
|
|
|
std::shared_ptr<Tensor> mTempOutput;
|
|
|
|
void* mOutputPtr;
|
|
|
|
bool mNeedZero = false;
|
|
|
|
bool mFast = false;
|
2021-04-08 15:34:23 +08:00
|
|
|
int mSingleConvert = 0;
|
2021-06-11 17:17:13 +08:00
|
|
|
std::vector<Tensor::InsideDescribe::Region> mCacheRegions;
|
2020-11-05 16:41:56 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|