Adds an layer to the neural network.
(&self, n: usize)
| 41 | |
| 42 | /// Adds an layer to the neural network. |
| 43 | pub fn add_layer(&self, n: usize) -> NeuralNetwork { |
| 44 | |
| 45 | NeuralNetwork { |
| 46 | layers: self.layers.append(&[n]), |
| 47 | params: match self.layers.last() { |
| 48 | Some(&m) => self.params.append(&[self.create_params(n, m, self.layers() == 1)]), |
| 49 | None => vec![] |
| 50 | } |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | /// Sets the parameters which connect the given layer `layer` with the next |
| 55 | /// layer. |