Caffe2 - C++ API
A deep learning, cross platform ML framework
module.h
1 
22 #ifndef CAFFE2_CORE_MODULE_H_
23 #define CAFFE2_CORE_MODULE_H_
24 
25 #include <algorithm>
26 #include <cstdio>
27 #include <cstdlib>
28 #include <functional>
29 #include <memory>
30 #include <mutex>
31 
32 #include "caffe2/core/common.h"
33 #include "caffe2/core/typeid.h"
34 
35 namespace caffe2 {
36 
42 class ModuleSchema {
43  public:
44  ModuleSchema(const char* name, const char* description);
45 
46  private:
47  const char* name_;
48  const char* description_;
49 };
50 
51 
64 const CaffeMap<string, const ModuleSchema*>& CurrentModules();
65 
69 bool HasModule(const string& name);
70 
79 void LoadModule(const string& name, const string& filename="");
80 
81 
82 #define CAFFE2_MODULE(name, description) \
83  extern "C" { \
84  const bool gCaffe2ModuleSanityCheck##name() { return true; } \
85  } \
86  namespace { \
87  static ::caffe2::ModuleSchema module_schema_##name(#name, description); \
88  }
89 
90 } // namespace caffe2
91 #endif // CAFFE2_CORE_MODULE_H_
bool HasModule(const string &name)
Checks whether a module is already present in the current binary.
Definition: module.cc:53
const CaffeMap< string, const ModuleSchema * > & CurrentModules()
Current Modules present in the Caffe2 runtime.
Definition: module.cc:43
Copyright (c) 2016-present, Facebook, Inc.
void LoadModule(const string &name, const string &filename)
Load a module.
Definition: module.cc:68
A module schema that can be used to store specific information about different modules.
Definition: module.h:42