Struct ducky_learn::layers::Dense1d

source ·
pub struct Dense1d { /* private fields */ }

Implementations§

source§

impl Dense1d

source

pub fn from(
    activation: fn(_: Array1<f64>) -> Array1<f64>,
    weights: Array2<f64>,
    bias: Array1<f64>
) -> Self

Create Dense1d layer with full control over every part of the layer

Arguments
  • activation: Activation function of whole 1d array
  • weights: 2d array that has to be of shape( output, input )
  • bias: 1d array of basis that has to be the size of the output

returns: Dense1d

Examples
use ducky_learn::layers::*;
use ndarray::{arr1, arr2};

let layer = Dense1d::from(
                |x| x, // Activation function that is does nothing
                arr2(&[[1., 1.], [1., 1.]]), // 2x2 array
                arr1(&[1., 1.]) // len 2
            );

Trait Implementations§

source§

impl FeedForward1d for Dense1d

source§

fn pass(&self, input_array: Array1<f64>) -> Array1<f64>

Feeds forward the 1d array through the layer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere
    T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere
    U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere
    U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere
    U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.