Struct revonet::neuro::NeuralLayer
[−]
[src]
pub struct NeuralLayer { /* fields omitted */ }
Structure to describe a layer for neural network.
Methods
impl NeuralLayer
[src]
fn new(size: usize, actf: ActivationFunctionType) -> NeuralLayer
Create a new layer with given size and activation function.
Arguments:
size
- number of nodes.actf
- type of activation function.
fn init_weights<R: Rng + Sized>(&mut self, inputs_num: usize, rng: &mut R)
Initializes weights of the layer.
Arguments:
inputs_num
- number of inputs for the layer.rng
- mutable reference to the external RNG.
fn compute(&mut self, xs: &[f32])
Compute output of the layer given a vector of input signals.
To get outputs use get_outputs
function.
Arguments:
xs
-- input vector.
fn get_inputs_num(&self) -> usize
Returns number of inputs.
fn len(&self) -> usize
Return number of nodes in the layer.
fn get_outputs(&self) -> &[f32]
Returns references to the slice, containing values of current outputs.
fn get_weights(&self) -> (Vec<f32>, Vec<f32>)
Return flattened vector of weights and biases.
fn set_weights(&mut self, ws: &Vec<f32>, bs: &Vec<f32>)
Set weights and biases for the layer.
Arguments:
ws
- vector of flattened weights.bs
- vector of biases.
Trait Implementations
impl Clone for NeuralLayer
[src]
fn clone(&self) -> NeuralLayer
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more