MCPcopy Create free account
hub / github.com/daniel-e/rustml / update_params

Method update_params

src/nn.rs:224–230  ·  view source on GitHub ↗

Updates the parameters of the network. Each matrix in `deltas` is added to the corresponding matrix of parameters of the network, i.e. the first matrix which contains the parameters from the first layer to the second layer, the second matrix is added to the parameters which contains the parameters from the second layer to the third layer and so on.

(&mut self, deltas: &[Matrix<f64>])

Source from the content-addressed store, hash-verified

222 /// the second matrix is added to the parameters which contains the
223 /// parameters from the second layer to the third layer and so on.
224 pub fn update_params(&mut self, deltas: &[Matrix<f64>]) {
225
226 assert!(self.params.len() == deltas.len(), "Dimensions do not match.");
227 for i in (0..self.params.len()) {
228 self.params[i].iadd(&deltas[i]);
229 }
230 }
231
232 /// Returns the parameters of the network.
233 pub fn params(&self) -> Vec<Matrix<f64>> {

Callers 2

optimizeMethod · 0.80
test_update_paramsFunction · 0.80

Calls 1

lenMethod · 0.45

Tested by 1

test_update_paramsFunction · 0.64