pub struct LstsqGrad<T: Scalar> {
pub a: Tensor<T>,
pub b: Tensor<T>,
}Expand description
Gradient result for lstsq_rrule: cotangents for both A and b.
§Examples
use tenferro_linalg::LstsqGrad;
use tenferro_tensor::{MemoryOrder, Tensor};
let grad = LstsqGrad {
a: Tensor::<f64>::zeros(&[2, 2], tenferro_device::LogicalMemorySpace::MainMemory, MemoryOrder::ColumnMajor).unwrap(),
b: Tensor::<f64>::zeros(&[2], tenferro_device::LogicalMemorySpace::MainMemory, MemoryOrder::ColumnMajor).unwrap(),
};
assert_eq!(grad.a.ndim(), 2);
assert_eq!(grad.b.ndim(), 1);Fields§
§a: Tensor<T>Cotangent for the system matrix A.
b: Tensor<T>Cotangent for the right-hand side b.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for LstsqGrad<T>
impl<T> !RefUnwindSafe for LstsqGrad<T>
impl<T> Send for LstsqGrad<T>
impl<T> Sync for LstsqGrad<T>
impl<T> Unpin for LstsqGrad<T>
impl<T> !UnwindSafe for LstsqGrad<T>
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<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
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