Trait nncombinator::Stack
source · [−]pub trait Stack {
type Remaining: Stack;
type Head;
fn pop(self) -> (Self::Remaining, Self::Head);
fn map<F: FnOnce(&Self::Head) -> O, O>(&self, f: F) -> O;
fn map_remaining<F: FnOnce(&Self::Remaining) -> O, O>(&self, f: F) -> O;
}
Expand description
Trait that defines a stack to store the results computed by forward propagation when training a neural network.
Required Associated Types
Required Methods
sourcefn pop(self) -> (Self::Remaining, Self::Head)
fn pop(self) -> (Self::Remaining, Self::Head)
Returns a tuple of the top item in the stack and the rest of the stack
sourcefn map<F: FnOnce(&Self::Head) -> O, O>(&self, f: F) -> O
fn map<F: FnOnce(&Self::Head) -> O, O>(&self, f: F) -> O
Returns the result of applying the callback function to the top element of the stack
Arguments
f
- Applicable callbacks
sourcefn map_remaining<F: FnOnce(&Self::Remaining) -> O, O>(&self, f: F) -> O
fn map_remaining<F: FnOnce(&Self::Remaining) -> O, O>(&self, f: F) -> O
Returns the result of applying the callback to a stack that does not contain the top element of the stack
f
- Applicable callbacks