svd_frule

Function svd_frule 

Source
pub fn svd_frule<T: Scalar>(
    _tensor: &Tensor<T>,
    _tangent: &Tensor<T>,
    _options: Option<&SvdOptions>,
) -> AdResult<(SvdResult<T>, SvdResult<T>)>
Expand description

Forward-mode AD rule for SVD (JVP / pushforward).

Computes the JVP of all SVD outputs given a tangent for the input. Uses batched matrix operations that broadcast over *.

§Examples

use tenferro_linalg::svd_frule;
use tenferro_tensor::{Tensor, MemoryOrder};
use tenferro_device::LogicalMemorySpace;

let col = MemoryOrder::ColumnMajor;
let mem = LogicalMemorySpace::MainMemory;
let a = Tensor::<f64>::zeros(&[3, 4], mem, col);
let da = Tensor::<f64>::ones(&[3, 4], mem, col);
let (result, dresult) = svd_frule(&a, &da, None).unwrap();