pub fn pinv_frule<T, C>(
ctx: &mut C,
tensor: &Tensor<T>,
tangent: &Tensor<T>,
rcond: Option<f64>,
) -> AdResult<(Tensor<T>, Tensor<T>)>where
T: KernelLinalgScalar + ScaleTensorByRealSameShape<C> + Conjugate,
C: TensorLinalgContextFor<T> + TensorResolveConjContextFor<T> + TensorScalarContextFor<Standard<T::Real>>,
C::Backend: 'static,
T::Real: KeepCountScalar,Expand description
Forward-mode AD rule for pseudoinverse (JVP / pushforward).
ยงExamples
use tenferro_linalg::pinv_frule;
use tenferro_prims::CpuContext;
use tenferro_tensor::{Tensor, MemoryOrder};
use tenferro_device::LogicalMemorySpace;
let col = MemoryOrder::ColumnMajor;
let mem = LogicalMemorySpace::MainMemory;
let mut ctx = CpuContext::new(1);
let a = Tensor::<f64>::zeros(&[3, 4], mem, col).unwrap();
let da = Tensor::<f64>::ones(&[3, 4], mem, col).unwrap();
let (pinv_a, dpinv_a) = pinv_frule(&mut ctx, &a, &da, None).unwrap();