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

Method initialize

python/singa/layer.py:483–492  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

481 self.initializer = initializer
482
483 def initialize(self, x):
484 w_shape = (self.input_dim, self.output_dim)
485 self.W = Tensor(shape=w_shape,
486 requires_grad=True,
487 stores_grad=True,
488 device=x.device)
489 if self.initializer == 'uniform':
490 self.W.uniform(-1., 1.)
491 else:
492 self.W.gaussian(0., 1.)
493
494 def from_pretrained(self, W, freeze=True):
495 self.set_params({self.W.name: W})

Callers

nothing calls this directly

Calls 3

TensorClass · 0.70
uniformMethod · 0.45
gaussianMethod · 0.45

Tested by

no test coverage detected