pub struct BackpropGpu {
pub gradients: Vec<Vec<f64>>,
}Expand description
Backpropagation state: stores per-layer gradient tensors.
Fields§
§gradients: Vec<Vec<f64>>Per-layer gradient vectors (same shape as the layer’s weight vector).
Implementations§
Source§impl BackpropGpu
impl BackpropGpu
Sourcepub fn new(net: &GpuNeuralNet) -> Self
pub fn new(net: &GpuNeuralNet) -> Self
Initialise gradient buffers matching the network’s weight shapes.
Sourcepub fn backward_pass(&mut self, loss_grad: &[f64])
pub fn backward_pass(&mut self, loss_grad: &[f64])
Perform a mock backward pass given the output loss gradient.
This is a simplified implementation: each layer’s gradient is set to
loss_grad[0] times the layer’s weight magnitudes (a stand-in for
a real backprop chain rule).
Trait Implementations§
Source§impl Clone for BackpropGpu
impl Clone for BackpropGpu
Source§fn clone(&self) -> BackpropGpu
fn clone(&self) -> BackpropGpu
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for BackpropGpu
impl RefUnwindSafe for BackpropGpu
impl Send for BackpropGpu
impl Sync for BackpropGpu
impl Unpin for BackpropGpu
impl UnsafeUnpin for BackpropGpu
impl UnwindSafe for BackpropGpu
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more