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

Method initialize

python/singa/layer.py:1172–1183  ·  view source on GitHub ↗
(self, xs, h0)

Source from the content-addressed store, hash-verified

1170 self.bidirectional = bidirectional
1171
1172 def initialize(self, xs, h0):
1173 Wx_shape = (self.input_size, self.hidden_size)
1174 self.Wx = Tensor(shape=Wx_shape, requires_grad=True, stores_grad=True)
1175 self.Wx.gaussian(0.0, 1.0)
1176
1177 Wh_shape = (self.hidden_size, self.hidden_size)
1178 self.Wh = Tensor(shape=Wh_shape, requires_grad=True, stores_grad=True)
1179 self.Wh.gaussian(0.0, 1.0)
1180
1181 b_shape = (self.hidden_size,)
1182 self.b = Tensor(shape=b_shape, requires_grad=True, stores_grad=True)
1183 self.b.set_value(0.0)
1184
1185 def forward(self, xs, h0):
1186 # xs: a tuple or list of input tensors

Callers 1

wrapperMethod · 0.45

Calls 3

TensorClass · 0.70
gaussianMethod · 0.45
set_valueMethod · 0.45

Tested by

no test coverage detected