Struct concision_linear::params::LinearParamsBase

source ·
pub struct LinearParamsBase<S, D = Ix2>
where D: RemoveAxis, S: RawData,
{ /* private fields */ }

Implementations§

source§

impl<A, S, D> LinearParamsBase<S, D>
where D: RemoveAxis, S: RawData<Elem = A>,

source

pub fn default<Sh>(biased: bool, shape: Sh) -> LinearParamsBase<S, D>
where Sh: ShapeBuilder<Dim = D>, A: Default, S: DataOwned,

source

pub fn ones<Sh>(biased: bool, shape: Sh) -> LinearParamsBase<S, D>
where Sh: ShapeBuilder<Dim = D>, A: Clone + One, S: DataOwned,

source

pub fn zeros<Sh>(biased: bool, shape: Sh) -> LinearParamsBase<S, D>
where Sh: ShapeBuilder<Dim = D>, A: Clone + Zero, S: DataOwned,

source

pub fn new<Sh>(shape: Sh) -> Self
where A: Clone + Default, S: DataOwned, Sh: ShapeBuilder<Dim = D>,

source

pub fn biased<F>(self, builder: F) -> Self
where F: Fn(D::Smaller) -> ArrayBase<S, D::Smaller>,

source

pub fn unbiased(self) -> Self

source

pub fn bias(&self) -> Option<&ArrayBase<S, D::Smaller>>

source

pub fn bias_mut(&mut self) -> Option<&mut ArrayBase<S, D::Smaller>>

source

pub fn weights(&self) -> &ArrayBase<S, D>

source

pub fn weights_mut(&mut self) -> &mut ArrayBase<S, D>

source

pub fn features(&self) -> Features

source

pub fn inputs(&self) -> usize

source

pub fn is_biased(&self) -> bool

source

pub fn linear<T, B>(&self, data: &T) -> B
where A: NdFloat, B: for<'a> Add<&'a ArrayBase<S, D::Smaller>, Output = B>, S: Data<Elem = A>, T: Dot<Array<A, D>, Output = B>,

source

pub fn ndim(&self) -> usize

source

pub fn outputs(&self) -> usize

source

pub fn raw_dim(&self) -> D

source

pub fn shape(&self) -> &[usize]

source§

impl<A, S> LinearParamsBase<S>
where S: RawData<Elem = A>,

source

pub fn set_node( &mut self, idx: usize, node: (Array<A, Ix1>, Option<Array<A, Ix0>>) )
where A: Clone + Default, S: DataMut + DataOwned,

source§

impl<A, S, D> LinearParamsBase<S, D>
where D: RemoveAxis, S: RawData<Elem = A>,

source

pub fn activate<F, X, Y>(&mut self, args: &X, f: F) -> Y
where F: for<'a> Fn(&'a Y) -> Y, S: Data<Elem = A>, Self: Predict<X, Output = Y>,

source§

impl<A, D> LinearParamsBase<OwnedRepr<A>, D>

source

pub fn init_uniform(self, biased: bool) -> Self

source

pub fn init_bias(self) -> Self

source

pub fn init_weight(self) -> Self

source

pub fn uniform(self) -> Self

Trait Implementations§

source§

impl<A, S, D> Biased for LinearParamsBase<S, D>
where D: RemoveAxis, S: RawData<Elem = A>,

§

type Bias = ArrayBase<S, <D as Dimension>::Smaller>

source§

fn bias(&self) -> &Self::Bias

Returns an owned reference to the bias of the layer.
source§

fn bias_mut(&mut self) -> &mut Self::Bias

Returns a mutable reference to the bias of the layer.
source§

fn set_bias(&mut self, bias: Self::Bias)

Sets the bias of the layer.
source§

impl<T, D> Borrow<LinearParamsBase<OwnedRepr<T>, D>> for Linear<T, D>
where D: RemoveAxis,

source§

fn borrow(&self) -> &LinearParams<T, D>

Immutably borrows from an owned value. Read more
source§

impl<T, D> BorrowMut<LinearParamsBase<OwnedRepr<T>, D>> for Linear<T, D>
where D: RemoveAxis,

source§

fn borrow_mut(&mut self) -> &mut LinearParams<T, D>

Mutably borrows from an owned value. Read more
source§

impl<A, S, D> Clone for LinearParamsBase<S, D>
where A: Clone, D: RemoveAxis, S: RawDataClone<Elem = A>,

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a, A, S, D> Deserialize<'a> for LinearParamsBase<S, D>
where A: Deserialize<'a>, D: Deserialize<'a> + RemoveAxis, S: DataOwned<Elem = A>, <D as Dimension>::Smaller: Deserialize<'a> + Dimension,

source§

fn deserialize<Der>(deserializer: Der) -> Result<Self, Der::Error>
where Der: Deserializer<'a>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<A> From<(ArrayBase<OwnedRepr<A>, Dim<[usize; 1]>>, A)> for LinearParamsBase<OwnedRepr<A>, Ix1>
where A: Clone,

source§

fn from((weight, bias): (Array1<A>, A)) -> Self

Converts to this type from the input type.
source§

impl<A> From<(ArrayBase<OwnedRepr<A>, Dim<[usize; 1]>>, Option<A>)> for LinearParamsBase<OwnedRepr<A>, Ix1>
where A: Clone,

source§

fn from((weights, bias): (Array1<A>, Option<A>)) -> Self

Converts to this type from the input type.
source§

impl<A, S, D> From<(ArrayBase<S, D>, ArrayBase<S, <D as Dimension>::Smaller>)> for LinearParamsBase<S, D>
where D: RemoveAxis, S: RawData<Elem = A>,

source§

fn from((weights, bias): (ArrayBase<S, D>, ArrayBase<S, D::Smaller>)) -> Self

Converts to this type from the input type.
source§

impl<A, S, D> From<(ArrayBase<S, D>, Option<ArrayBase<S, <D as Dimension>::Smaller>>)> for LinearParamsBase<S, D>
where D: RemoveAxis, S: RawData<Elem = A>,

source§

fn from( (weights, bias): (ArrayBase<S, D>, Option<ArrayBase<S, D::Smaller>>) ) -> Self

Converts to this type from the input type.
source§

impl<A, S> FromIterator<(ArrayBase<OwnedRepr<A>, Dim<[usize; 1]>>, Option<ArrayBase<OwnedRepr<A>, Dim<[usize; 0]>>>)> for LinearParamsBase<S, Ix2>
where A: Clone + Default, S: DataOwned<Elem = A> + DataMut,

source§

fn from_iter<I: IntoIterator<Item = (Array1<A>, Option<Array0<A>>)>>( nodes: I ) -> Self

Creates a value from an iterator. Read more
source§

impl<A, S> IntoIterator for LinearParamsBase<S>
where A: Clone, S: Data<Elem = A>,

§

type Item = (ArrayBase<OwnedRepr<A>, Dim<[usize; 1]>>, Option<ArrayBase<OwnedRepr<A>, Dim<[usize; 0]>>>)

The type of the elements being iterated over.
§

type IntoIter = IntoIter<<LinearParamsBase<S> as IntoIterator>::Item>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<A, S, D> PartialEq<(ArrayBase<S, D>, ArrayBase<S, <D as Dimension>::Smaller>)> for LinearParamsBase<S, D>
where A: PartialEq, D: RemoveAxis, S: Data<Elem = A>,

source§

fn eq( &self, (weights, bias): &(ArrayBase<S, D>, ArrayBase<S, D::Smaller>) ) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A, S, D> PartialEq<(ArrayBase<S, D>, Option<ArrayBase<S, <D as Dimension>::Smaller>>)> for LinearParamsBase<S, D>
where A: PartialEq, D: RemoveAxis, S: Data<Elem = A>,

source§

fn eq( &self, (weights, bias): &(ArrayBase<S, D>, Option<ArrayBase<S, D::Smaller>>) ) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A, S, D> PartialEq for LinearParamsBase<S, D>
where A: PartialEq, D: RemoveAxis, S: Data<Elem = A>,

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, A, B, T, S, D> Predict<A> for &'a LinearParamsBase<S, D>
where A: Dot<Array<T, D>, Output = B>, B: Add<&'a ArrayBase<S, D::Smaller>, Output = B>, D: RemoveAxis, S: Data<Elem = T>, T: NdFloat,

§

type Output = B

source§

fn predict(&self, input: &A) -> Result<Self::Output, PredictError>

source§

impl<A, B, T, S, D> Predict<A> for LinearParamsBase<S, D>
where A: Dot<Array<T, D>, Output = B>, B: for<'a> Add<&'a ArrayBase<S, D::Smaller>, Output = B>, D: RemoveAxis, S: Data<Elem = T>, T: ComplexFloat,

§

type Output = B

source§

fn predict(&self, input: &A) -> Result<Self::Output, PredictError>

source§

impl<A, S, D> Serialize for LinearParamsBase<S, D>
where A: Serialize, D: RemoveAxis + Serialize, S: Data<Elem = A>, <D as Dimension>::Smaller: Dimension + Serialize,

source§

fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
where Ser: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<A, S, D> Weighted for LinearParamsBase<S, D>
where D: RemoveAxis, S: RawData<Elem = A>,

§

type Weight = ArrayBase<S, D>

source§

fn weights(&self) -> &Self::Weight

Returns an owned reference to the weights of the layer.
source§

fn weights_mut(&mut self) -> &mut Self::Weight

Returns a mutable reference to the weights of the layer.
source§

fn set_weights(&mut self, weights: Self::Weight)

Sets the weights of the layer.
source§

impl<A, S, D> Copy for LinearParamsBase<S, D>
where A: Copy, D: Copy + RemoveAxis, S: Copy + RawDataClone<Elem = A>, <D as Dimension>::Smaller: Copy,

Auto Trait Implementations§

§

impl<S, D> Freeze for LinearParamsBase<S, D>
where S: Freeze, D: Freeze, <D as Dimension>::Smaller: Freeze,

§

impl<S, D> RefUnwindSafe for LinearParamsBase<S, D>

§

impl<S, D> Send for LinearParamsBase<S, D>
where S: Send + Data,

§

impl<S, D> Sync for LinearParamsBase<S, D>
where S: Sync + Data,

§

impl<S, D> Unpin for LinearParamsBase<S, D>
where S: Unpin, D: Unpin, <D as Dimension>::Smaller: Unpin,

§

impl<S, D> UnwindSafe for LinearParamsBase<S, D>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

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

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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> LinearActivation for T
where T: Clone,

§

type Output = T

source§

fn linear(&self) -> <T as LinearActivation>::Output

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,