pub struct SurfaceModel<A = f64> { /* private fields */ }Expand description
A multi-layer perceptron implementation
Implementations§
Source§impl<A> SurfaceModel<A>
impl<A> SurfaceModel<A>
Sourcepub fn default(config: SurfaceModelConfig<A>, features: ModelFeatures) -> Self
pub fn default(config: SurfaceModelConfig<A>, features: ModelFeatures) -> Self
create a new instance of the model; all parameters are initialized to their defaults
Sourcepub fn ones(config: SurfaceModelConfig<A>, features: ModelFeatures) -> Self
pub fn ones(config: SurfaceModelConfig<A>, features: ModelFeatures) -> Self
create a new instance of the model; all parameters are initialized to 1
Sourcepub fn zeros(config: SurfaceModelConfig<A>, features: ModelFeatures) -> Self
pub fn zeros(config: SurfaceModelConfig<A>, features: ModelFeatures) -> Self
create a new instance of the model; all parameters are initialized to 0
Sourcepub const fn attention(&self) -> Option<&FftAttention<A>>
pub const fn attention(&self) -> Option<&FftAttention<A>>
returns an immutable reference to the attention mechanism of the model
Sourcepub const fn attention_mut(&mut self) -> Option<&mut FftAttention<A>>
pub const fn attention_mut(&mut self) -> Option<&mut FftAttention<A>>
returns a mutable reference to the attention mechanism of the model
Sourcepub const fn config(&self) -> &SurfaceModelConfig<A>
pub const fn config(&self) -> &SurfaceModelConfig<A>
returns an immutable reference to the model’s configuration
Sourcepub const fn config_mut(&mut self) -> &mut SurfaceModelConfig<A>
pub const fn config_mut(&mut self) -> &mut SurfaceModelConfig<A>
returns a mutable reference to the model’s configuration
Sourcepub const fn features(&self) -> ModelFeatures
pub const fn features(&self) -> ModelFeatures
returns an immutable reference to the model’s features
Sourcepub const fn features_mut(&mut self) -> &mut ModelFeatures
pub const fn features_mut(&mut self) -> &mut ModelFeatures
returns a mutable reference to the model’s features
Sourcepub const fn params(&self) -> &ModelParams<A>
pub const fn params(&self) -> &ModelParams<A>
returns an immutable reference to the model’s parameters
Sourcepub const fn params_mut(&mut self) -> &mut ModelParams<A>
pub const fn params_mut(&mut self) -> &mut ModelParams<A>
returns a mutable reference to the model’s parameters
Sourcepub const fn velocities(&self) -> &ModelParams<A>
pub const fn velocities(&self) -> &ModelParams<A>
returns an immutable reference to the model’s velocities
Sourcepub const fn velocities_mut(&mut self) -> &mut ModelParams<A>
pub const fn velocities_mut(&mut self) -> &mut ModelParams<A>
returns a mutable reference to the model’s velocities
Sourcepub const fn input(&self) -> &Params<A>
pub const fn input(&self) -> &Params<A>
returns an immutable reference to the input layer of the model
Sourcepub const fn input_mut(&mut self) -> &mut Params<A>
pub const fn input_mut(&mut self) -> &mut Params<A>
returns a mutable reference to the input layer of the model
returns an immutable reference to the hidden layers of the model
returns an immutable reference to the hidden layers of the model as a slice
returns an immutable reference to the hidden layers of the model as a slice
Sourcepub const fn output(&self) -> &Params<A>
pub const fn output(&self) -> &Params<A>
returns an immutable reference to the output layer of the model
Sourcepub const fn output_mut(&mut self) -> &mut Params<A>
pub const fn output_mut(&mut self) -> &mut Params<A>
returns a mutable reference to the output layer of the model
Sourcepub const fn learning_rate(&self) -> &A
pub const fn learning_rate(&self) -> &A
returns an immutable reference to the learning rate of the model
Sourcepub fn set_attention(&mut self, attention: Option<FftAttention<A>>) -> &mut Self
pub fn set_attention(&mut self, attention: Option<FftAttention<A>>) -> &mut Self
set the model’s attention mechanism
Sourcepub fn set_config(&mut self, config: SurfaceModelConfig<A>) -> &mut Self
pub fn set_config(&mut self, config: SurfaceModelConfig<A>) -> &mut Self
set the model’s configuration
Sourcepub fn set_features(&mut self, features: ModelFeatures) -> &mut Self
pub fn set_features(&mut self, features: ModelFeatures) -> &mut Self
set the model’s features
Sourcepub fn set_params(&mut self, params: ModelParams<A>) -> &mut Self
pub fn set_params(&mut self, params: ModelParams<A>) -> &mut Self
set the model’s parameters
set the hidden layers of the model
Sourcepub fn set_output(&mut self, output: Params<A>) -> &mut Self
pub fn set_output(&mut self, output: Params<A>) -> &mut Self
set the output layer of the model
Sourcepub fn set_learning_rate(&mut self, learning_rate: A) -> &mut Self
pub fn set_learning_rate(&mut self, learning_rate: A) -> &mut Self
set the learning rate for the model
Sourcepub fn set_momentum(&mut self, momentum: A) -> &mut Self
pub fn set_momentum(&mut self, momentum: A) -> &mut Self
set the model’s momentum
Sourcepub fn with_attention(self) -> Selfwhere
A: FromPrimitive,
pub fn with_attention(self) -> Selfwhere
A: FromPrimitive,
create a new instance of the model with the specified attention mechanism
Sourcepub fn with_config(self, config: SurfaceModelConfig<A>) -> Self
pub fn with_config(self, config: SurfaceModelConfig<A>) -> Self
consumes the current instance and returns another with the specified configuration
Sourcepub fn with_features(self, features: ModelFeatures) -> Self
pub fn with_features(self, features: ModelFeatures) -> Self
consumes the current instance and returns another with the given features
Sourcepub fn with_input(self, input: Params<A>) -> Self
pub fn with_input(self, input: Params<A>) -> Self
consumes the current instance and returns another with the specified input layer
consumes the current instance and returns another with the specified hidden layers
Sourcepub fn with_output(self, output: Params<A>) -> Self
pub fn with_output(self, output: Params<A>) -> Self
consumes the current instance and returns another with the specified output layer
Sourcepub fn has_attention(&self) -> bool
pub fn has_attention(&self) -> bool
returns true if the model has an attention mechanism
Sourcepub fn has_no_attention(&self) -> bool
pub fn has_no_attention(&self) -> bool
returns true if the model has no attention mechanism
Source§impl<A> SurfaceModel<A>
impl<A> SurfaceModel<A>
Sourcepub fn init(self) -> Selfwhere
Self: Init,
pub fn init(self) -> Selfwhere
Self: Init,
consumes the current instance to initialize the model params
Sourcepub fn init_inplace(&mut self) -> &mut Selfwhere
Self: InitInplace,
pub fn init_inplace(&mut self) -> &mut Selfwhere
Self: InitInplace,
initialize the model params in place
Source§impl<A> SurfaceModel<A>
impl<A> SurfaceModel<A>
Trait Implementations§
Source§impl<A: Clone> Clone for SurfaceModel<A>
impl<A: Clone> Clone for SurfaceModel<A>
Source§fn clone(&self) -> SurfaceModel<A>
fn clone(&self) -> SurfaceModel<A>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<A: Debug> Debug for SurfaceModel<A>
impl<A: Debug> Debug for SurfaceModel<A>
Source§impl<A> Default for SurfaceModel<A>
impl<A> Default for SurfaceModel<A>
Source§impl<S, T> Forward<ArrayBase<S, Dim<[usize; 1]>>> for SurfaceModel<T>
impl<S, T> Forward<ArrayBase<S, Dim<[usize; 1]>>> for SurfaceModel<T>
type Output = ArrayBase<OwnedRepr<T>, Dim<[usize; 1]>>
Source§fn forward_then<F>(&self, input: &Rhs, then: F) -> Result<Self::Output, Error>
fn forward_then<F>(&self, input: &Rhs, then: F) -> Result<Self::Output, Error>
Source§impl<S, T> Forward<ArrayBase<S, Dim<[usize; 2]>>> for SurfaceModel<T>
impl<S, T> Forward<ArrayBase<S, Dim<[usize; 2]>>> for SurfaceModel<T>
type Output = ArrayBase<OwnedRepr<T>, Dim<[usize; 2]>>
Source§fn forward_then<F>(&self, input: &Rhs, then: F) -> Result<Self::Output, Error>
fn forward_then<F>(&self, input: &Rhs, then: F) -> Result<Self::Output, Error>
Source§impl<A> Init for SurfaceModel<A>
impl<A> Init for SurfaceModel<A>
Source§impl<A> InitInplace for SurfaceModel<A>
impl<A> InitInplace for SurfaceModel<A>
Source§fn init_inplace(&mut self) -> &mut Self
fn init_inplace(&mut self) -> &mut Self
Source§impl<A> PartialEq for SurfaceModel<A>
impl<A> PartialEq for SurfaceModel<A>
Source§impl<A, S, T> Train<ArrayBase<S, Dim<[usize; 1]>>, ArrayBase<T, Dim<[usize; 1]>>> for SurfaceModel<A>where
A: FftNum + Float + FromPrimitive + NumAssign + ScalarOperand,
S: Data<Elem = A>,
T: Data<Elem = A>,
impl<A, S, T> Train<ArrayBase<S, Dim<[usize; 1]>>, ArrayBase<T, Dim<[usize; 1]>>> for SurfaceModel<A>where
A: FftNum + Float + FromPrimitive + NumAssign + ScalarOperand,
S: Data<Elem = A>,
T: Data<Elem = A>,
Auto Trait Implementations§
impl<A> Freeze for SurfaceModel<A>where
A: Freeze,
impl<A> RefUnwindSafe for SurfaceModel<A>where
A: RefUnwindSafe,
impl<A> Send for SurfaceModel<A>where
A: Send,
impl<A> Sync for SurfaceModel<A>where
A: Sync,
impl<A> Unpin for SurfaceModel<A>where
A: Unpin,
impl<A> UnwindSafe for SurfaceModel<A>where
A: UnwindSafe + RefUnwindSafe,
Blanket Implementations§
Source§impl<T> AsWeight<T> for Twhere
T: Clone + IntoWeight<T>,
impl<T> AsWeight<T> for Twhere
T: Clone + IntoWeight<T>,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<K, S> Identity<K> for Swhere
S: Borrow<K>,
K: Identifier,
impl<K, S> Identity<K> for Swhere
S: Borrow<K>,
K: Identifier,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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