MCPcopy Create free account
hub / github.com/apache/singa / CreateInitializer

Function CreateInitializer

include/singa/model/initializer.h:109–126  ·  view source on GitHub ↗

TODO(wangwei) create the initializers from factory like that for Layer.

Source from the content-addressed store, hash-verified

107
108/// TODO(wangwei) create the initializers from factory like that for Layer.
109std::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_

Callers 1

CompileMethod · 0.85

Calls 3

ToLowerCaseFunction · 0.85
typeMethod · 0.80
SetupMethod · 0.45

Tested by

no test coverage detected