mirror of
https://github.com/open-mmlab/mmdeploy.git
synced 2025-01-14 08:09:43 +08:00
31 lines
695 B
C
31 lines
695 B
C
|
#ifndef NCNN_OPS_DEFINER_H
|
||
|
#define NCNN_OPS_DEFINER_H
|
||
|
|
||
|
#include <string>
|
||
|
|
||
|
#include "layer.h"
|
||
|
#include "ncnn_ops_register.h"
|
||
|
|
||
|
namespace mmlab {
|
||
|
|
||
|
class NCNNOpsDefiner {
|
||
|
public:
|
||
|
NCNNOpsDefiner(const std::string& ops_name,
|
||
|
const ncnn::layer_creator_func& creator_func = 0,
|
||
|
const ncnn::layer_destroyer_func& destroyer_func = 0)
|
||
|
: _ops_name(ops_name) {
|
||
|
get_mm_layer_creator()[_ops_name.c_str()] = creator_func;
|
||
|
}
|
||
|
|
||
|
private:
|
||
|
const std::string _ops_name;
|
||
|
};
|
||
|
|
||
|
#define DEFINE_NCNN_OPS(ops_name, OpsLayer) \
|
||
|
static mmlab::NCNNOpsDefiner NCNNOpsDefiner##ops_name{ \
|
||
|
#ops_name, OpsLayer##_layer_creator};
|
||
|
|
||
|
} // namespace mmlab
|
||
|
|
||
|
#endif
|