pub trait Layer1d {
// Required method
fn pass(&self, input_array: Array1<f64>) -> (Array1<f64>, Array1<f64>);
}Required Methods§
Sourcefn pass(&self, input_array: Array1<f64>) -> (Array1<f64>, Array1<f64>)
fn pass(&self, input_array: Array1<f64>) -> (Array1<f64>, Array1<f64>)
Feeds forward the 1d array through the layer.
§Arguments
input_array: Has to be the same size as the input size of the layer else will panic
returns: Array1<f64>
§Examples
use ducky_learn::layers::*;
use ndarray::{arr1, arr2};
let layer = Dense1d::from(
|x| x, // Activation function that is does nothing
|x| x.map(|i| 1f64), // Derivative of Activation function
arr2(&[[1., 1.], [1., 1.]]), // 2x2 array
arr1(&[1., 1.]) // len 2
);
let output = layer.pass(arr1(&[1., 1.]));