einsum_frule

Function einsum_frule 

Source
pub fn einsum_frule<Alg, Backend>(
    ctx: &mut BackendContext<Alg, Backend>,
    subscripts: &str,
    primals: &[&Tensor<Alg::Scalar>],
    tangents: &[Option<&Tensor<Alg::Scalar>>],
) -> Result<Tensor<Alg::Scalar>>
where Alg: Semiring, Alg::Scalar: Scalar + Conjugate + HasAlgebra<Algebra = Alg>, Backend: EinsumBackend<Alg>, BackendContext<Alg, Backend>: TensorTempPoolContext,
Expand description

Forward-mode rule (frule) for einsum without building a global tape.

§Examples

use tenferro_algebra::Standard;
use tenferro_einsum::einsum_frule;
use tenferro_prims::{CpuBackend, CpuContext};

let mut ctx = CpuContext::new(1);
let tangent =
    einsum_frule::<Standard<f64>, CpuBackend>(&mut ctx, "ij,jk->ik", &[&a, &b], &[Some(&da), None])
        .unwrap();