2020-11-05 16:41:56 +08:00
|
|
|
//
|
|
|
|
// GeometryComputerUtils.hpp
|
|
|
|
// MNN
|
|
|
|
//
|
|
|
|
// Created by MNN on 2020/05/11.
|
|
|
|
// Copyright © 2018, Alibaba Group Holding Limited
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef GeometryComputerUtils_hpp
|
|
|
|
#define GeometryComputerUtils_hpp
|
|
|
|
#include "core/Schedule.hpp"
|
|
|
|
#include "geometry/GeometryComputer.hpp"
|
|
|
|
namespace MNN {
|
2021-02-07 10:45:07 +08:00
|
|
|
class GeometryComputerUtils {
|
2020-11-05 16:41:56 +08:00
|
|
|
public:
|
2021-02-07 10:45:07 +08:00
|
|
|
MNN_PUBLIC static void makeRaster(const CommandBuffer& srcBuffer, CommandBuffer& dstBuffer, GeometryComputer::Context& ctx);
|
2020-11-05 16:41:56 +08:00
|
|
|
static void addConvert(const CommandBuffer& srcBuffer, CommandBuffer& dstBuffer, GeometryComputer::Context& ctx);
|
2021-11-30 10:10:53 +08:00
|
|
|
static SharedPtr<Command> makeCommand(flatbuffers::FlatBufferBuilder& builder, const std::vector<Tensor*>& inputs, const std::vector<Tensor*>& outputs);
|
|
|
|
static SharedPtr<Command> makeBinary(int type, Tensor* input0, Tensor* input1, Tensor* output);
|
|
|
|
static SharedPtr<Command> makeReduce(ReductionType type, Tensor* input0, Tensor* output);
|
|
|
|
static SharedPtr<Command> makeUnary(UnaryOpOperation type, Tensor* input0, Tensor* output);
|
|
|
|
static SharedPtr<Command> makeMatMul(Tensor* input0, Tensor* input1, Tensor* output, Tensor* Bias = nullptr,
|
2020-11-05 16:41:56 +08:00
|
|
|
bool transposeA = false, bool transposeB = false);
|
2021-02-07 10:45:07 +08:00
|
|
|
static flatbuffers::Offset<Op> makePool(flatbuffers::FlatBufferBuilder& builder, std::pair<int, int> kernel, std::pair<int, int> stride, PoolType type, MNN::PoolPadType pad, std::pair<int, int> pads, bool isglobal, AvgPoolCountType countType = AvgPoolCountType_DEFAULT);
|
2020-11-05 16:41:56 +08:00
|
|
|
|
|
|
|
static Tensor::InsideDescribe::Region makeRawAddressRef(Tensor* src, int srcOffset, int size, int dstOffset = 0);
|
|
|
|
static void makeRawAddressRef(Tensor* dst, Tensor* src, int srcOffset, int size, int dstOffset = 0);
|
2021-11-30 10:10:53 +08:00
|
|
|
MNN_PUBLIC static int buildConstantTensors(std::vector<Schedule::PipelineInfo>& infos);
|
|
|
|
MNN_PUBLIC static ErrorCode shapeComputeAndGeometryTransform(std::vector<Schedule::PipelineInfo>& infos,
|
2020-11-05 16:41:56 +08:00
|
|
|
GeometryComputer::Context& geoContext,
|
2021-06-11 17:17:13 +08:00
|
|
|
std::shared_ptr<Backend> backupBackend,
|
|
|
|
Runtime::CompilerType compileType);
|
2020-11-05 16:41:56 +08:00
|
|
|
};
|
|
|
|
}; // namespace MNN
|
|
|
|
|
|
|
|
#endif
|