MCPcopy Create free account
hub / github.com/rushter/MLAlgorithms / setup_weights

Method setup_weights

mla/neuralnet/parameters.py:49–56  ·  view source on GitHub ↗
(self, W_shape, b_shape=None)

Source from the content-addressed store, hash-verified

47 self._grads = {}
48
49 def setup_weights(self, W_shape, b_shape=None):
50 if "W" not in self._params:
51 self._params["W"] = self.init(shape=W_shape, scale=self.scale)
52 if b_shape is None:
53 self._params["b"] = np.full(W_shape[1], self.initial_bias)
54 else:
55 self._params["b"] = np.full(b_shape, self.initial_bias)
56 self.init_grad()
57
58 def init_grad(self):
59 """Init gradient arrays corresponding to each weight array."""

Callers 3

setupMethod · 0.80
setupMethod · 0.80
setupMethod · 0.80

Calls 1

init_gradMethod · 0.95

Tested by

no test coverage detected