pub struct NeuralIntegration<A: Float, D: Dimension> { /* private fields */ }Expand description
Neural network integration manager
Implementations§
Source§impl<A: Float + ScalarOperand + Debug + 'static + FromPrimitive + Sum + Send + Sync, D: Dimension + 'static> NeuralIntegration<A, D>
impl<A: Float + ScalarOperand + Debug + 'static + FromPrimitive + Sum + Send + Sync, D: Dimension + 'static> NeuralIntegration<A, D>
Sourcepub fn new(config: OptimizationConfig<A>) -> Self
pub fn new(config: OptimizationConfig<A>) -> Self
Create a new neural integration manager
Sourcepub fn register_forward_hook<H>(&mut self, layerid: LayerId, hook: H)where
H: ForwardHook<A, D> + 'static,
pub fn register_forward_hook<H>(&mut self, layerid: LayerId, hook: H)where
H: ForwardHook<A, D> + 'static,
Register a forward hook for a layer
Sourcepub fn register_backward_hook<H>(&mut self, layerid: LayerId, hook: H)where
H: BackwardHook<A, D> + 'static,
pub fn register_backward_hook<H>(&mut self, layerid: LayerId, hook: H)where
H: BackwardHook<A, D> + 'static,
Register a backward hook for a layer
Sourcepub fn enable_gradient_accumulation(&mut self)
pub fn enable_gradient_accumulation(&mut self)
Enable gradient accumulation
Sourcepub fn disable_gradient_accumulation(&mut self) -> HashMap<ParamId, Array<A, D>>
pub fn disable_gradient_accumulation(&mut self) -> HashMap<ParamId, Array<A, D>>
Disable gradient accumulation and return accumulated gradients
Sourcepub fn forward_pass(
&mut self,
layerid: &LayerId,
inputs: &[Array<A, D>],
) -> Result<Vec<Array<A, D>>>
pub fn forward_pass( &mut self, layerid: &LayerId, inputs: &[Array<A, D>], ) -> Result<Vec<Array<A, D>>>
Execute forward pass with hooks
Sourcepub fn backward_pass(
&mut self,
layerid: &LayerId,
grad_outputs: &[Array<A, D>],
) -> Result<Vec<Array<A, D>>>
pub fn backward_pass( &mut self, layerid: &LayerId, grad_outputs: &[Array<A, D>], ) -> Result<Vec<Array<A, D>>>
Execute backward pass with hooks
Sourcepub fn accumulate_gradients(
&mut self,
gradients: HashMap<ParamId, Array<A, D>>,
) -> Result<()>
pub fn accumulate_gradients( &mut self, gradients: HashMap<ParamId, Array<A, D>>, ) -> Result<()>
Accumulate gradients for parameters
Sourcepub fn parameter_manager(&self) -> &ParameterManager<A, D>
pub fn parameter_manager(&self) -> &ParameterManager<A, D>
Get parameter manager
Sourcepub fn parameter_manager_mut(&mut self) -> &mut ParameterManager<A, D>
pub fn parameter_manager_mut(&mut self) -> &mut ParameterManager<A, D>
Get mutable parameter manager
Sourcepub fn accumulation_count(&self) -> usize
pub fn accumulation_count(&self) -> usize
Get accumulation count
Auto Trait Implementations§
impl<A, D> !RefUnwindSafe for NeuralIntegration<A, D>
impl<A, D> !Send for NeuralIntegration<A, D>
impl<A, D> !Sync for NeuralIntegration<A, D>
impl<A, D> !UnwindSafe for NeuralIntegration<A, D>
impl<A, D> Freeze for NeuralIntegration<A, D>where
A: Freeze,
impl<A, D> Unpin for NeuralIntegration<A, D>
impl<A, D> UnsafeUnpin for NeuralIntegration<A, D>where
A: UnsafeUnpin,
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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 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> ⓘ
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.