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

Method Fill

include/singa/model/initializer.h:87–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85class Xavier : public Initializer {
86public:
87 void Fill(Tensor& t) override {
88 CHECK_EQ(t.nDim(), 2u);
89 float scale = sqrt(6.0f / (t.shape(0) + t.shape(1)));
90 LOG(INFO) << "xavier scale " << scale;
91 singa::Uniform(-scale, scale, &t);
92 }
93};
94
95/// Ref: [He, Zhang, Ren and Sun 2015]: Delving Deep into Rectifiers:

Callers

nothing calls this directly

Calls 4

nDimMethod · 0.80
shapeMethod · 0.80
UniformClass · 0.70
sqrtFunction · 0.50

Tested by

no test coverage detected