TODO(wangwei) create the initializers from factory like that for Layer.
| 107 | |
| 108 | /// TODO(wangwei) create the initializers from factory like that for Layer. |
| 109 | std::shared_ptr<Initializer> CreateInitializer(const InitializerConf& conf) { |
| 110 | std::shared_ptr<Initializer> init; |
| 111 | if (ToLowerCase(conf.type()) == "constant") { |
| 112 | init = std::make_shared<init::Constant>(); |
| 113 | } else if (ToLowerCase(conf.type()) == "uniform") { |
| 114 | init = std::make_shared<init::Uniform>(); |
| 115 | } else if (ToLowerCase(conf.type()) == "gaussian") { |
| 116 | init = std::make_shared<init::Gaussian>(); |
| 117 | } else if (ToLowerCase(conf.type()) == "xavier") { |
| 118 | init = std::make_shared<init::Xavier>(); |
| 119 | } else if (ToLowerCase(conf.type()) == "msra") { |
| 120 | init = std::make_shared<init::MSRA>(); |
| 121 | } else { |
| 122 | LOG(FATAL) << "Unknown initialization type: " << conf.type(); |
| 123 | } |
| 124 | init->Setup(conf); |
| 125 | return init; |
| 126 | } |
| 127 | } // namespace singa |
| 128 | #endif // SINGA_MODEL_INITIALIZER_H_ |
no test coverage detected