MNN/source/backend/cpu/CPUCast.hpp

28 lines
873 B
C++
Raw Normal View History

2019-04-17 10:49:11 +08:00
//
// CPUCast.hpp
// MNN
//
// Created by MNN on 2018/08/05.
// Copyright © 2018, Alibaba Group Holding Limited
//
#ifndef CPUCast_hpp
#define CPUCast_hpp
2019-12-27 22:16:57 +08:00
#include "backend/cpu/CPUBackend.hpp"
2019-04-17 10:49:11 +08:00
namespace MNN {
class CPUCastCreator : public CPUBackend::Creator {
public:
enum ConvertType {
INT8_TO_FlOAT = 0,
FlOAT_TO_INT8 = 1,
};
2019-04-17 10:49:11 +08:00
virtual Execution* onCreate(const std::vector<Tensor*>& inputs, const std::vector<Tensor*>& outputs,
const MNN::Op* op, Backend* backend) const override;
static ErrorCode cast(const Tensor* input, const Tensor* output, const CPUBackend* bn, ConvertType type);
static ErrorCode cast(void* const inputRaw, void* outputRaw, ConvertType type, int number, float scale, float zero, float min, float max, const CPUBackend* bn);
2019-04-17 10:49:11 +08:00
};
} // namespace MNN
#endif /* CPUCast_hpp */