MCPcopy Create free account
hub / github.com/ddbourgin/numpy-ml / flush_gradients

Method flush_gradients

numpy_ml/neural_nets/modules/modules.py:64–74  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

62 self.flush_gradients()
63
64 def flush_gradients(self):
65 assert self.trainable, "Layer is frozen"
66
67 self.X = []
68 self._dv = {}
69 for c in self.components:
70 for k, v in c.derived_variables.items():
71 c.derived_variables[k] = None
72
73 for k, v in c.gradients.items():
74 c.gradients[k] = np.zeros_like(v)
75
76 def set_params(self, summary_dict):
77 cids = self.hyperparameters["component_ids"]

Callers 1

updateMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected