public: #if NCNN_STRING // layer type name std::string type; // layer name std::string name; #endif// NCNN_STRING // blob index which this layer needs as input std::vector<int> bottoms; // blob index which this layer produces as output std::vector<int> tops; };
// layer factory function typedef Layer* (*layer_creator_func)();
structlayer_registry_entry { #if NCNN_STRING // layer type name constchar* name; #endif// NCNN_STRING // layer factory entry layer_creator_func creator; };
#if NCNN_STRING // get layer type from type name intlayer_to_index(constchar* type); // create layer from type name Layer* create_layer(constchar* type); #endif// NCNN_STRING // create layer from layer type Layer* create_layer(int index);
#define DEFINE_LAYER_CREATOR(name) \ ::ncnn::Layer* name##_layer_creator() { return new name; }