pub struct ModelSlot;Expand description
Generic Model slot placeholder. Bind a concrete ModelRuntime via
Node::with_model(...). Exposes the six role-method
DSL operations:
Forward, Backward, ComputeLoss, ApplyDelta,
LoadParameters, Params.
Implementations§
Source§impl ModelSlot
impl ModelSlot
Sourcepub fn forward(&self, g: &mut Graph, input: Output) -> Output
pub fn forward(&self, g: &mut Graph, input: Output) -> Output
Forward(input) -> output - tensor → tensor forward pass.
Sourcepub fn backward(&self, g: &mut Graph, grad: Output) -> Output
pub fn backward(&self, g: &mut Graph, grad: Output) -> Output
Backward(grad) -> cmd - accumulate gradients given upstream gradient.
Sourcepub fn compute_loss(
&self,
g: &mut Graph,
input: Output,
target: Output,
) -> Output
pub fn compute_loss( &self, g: &mut Graph, input: Output, target: Output, ) -> Output
ComputeLoss(input, target) -> loss - scalar loss score.
Sourcepub fn apply_delta(&self, g: &mut Graph, delta: Output) -> Output
pub fn apply_delta(&self, g: &mut Graph, delta: Output) -> Output
ApplyDelta(delta) -> cmd - apply parameter delta in-place.
Sourcepub fn load_parameters(&self, g: &mut Graph, params: Output) -> Output
pub fn load_parameters(&self, g: &mut Graph, params: Output) -> Output
LoadParameters(params) -> cmd - load parameters wholesale.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ModelSlot
impl RefUnwindSafe for ModelSlot
impl Send for ModelSlot
impl Sync for ModelSlot
impl Unpin for ModelSlot
impl UnsafeUnpin for ModelSlot
impl UnwindSafe for ModelSlot
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