(self, W_shape, b_shape=None)
| 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.""" |