pub trait EagerTensorLinalgExt {
// Required method
fn solve(
&self,
engine: &mut dyn ExecutionEngine,
b: &EagerTensor,
) -> Result<EagerTensor>;
}Expand description
Tensor-owned linear solve. Other eager linear-algebra operations use
EagerSessionLinalgExt inside tenferro_ad::EagerRuntime::with_eager_session.
The tensor-owned entry preserves calling-thread no_grad behavior for
tracked solves; it must not be called from inside a borrowed session.
§Examples
let x = a.solve(&mut tenferro_cpu::CpuEngine::serial(), &b)?;
assert_eq!(x.shape(), &[1, 1]);Required Methods§
Sourcefn solve(
&self,
engine: &mut dyn ExecutionEngine,
b: &EagerTensor,
) -> Result<EagerTensor>
fn solve( &self, engine: &mut dyn ExecutionEngine, b: &EagerTensor, ) -> Result<EagerTensor>
The CUDA provider does not inspect the cuSOLVER getrf status flag on
the forward solve path, so it performs no per-call non-singularity check
and issues no host round trip. An exactly singular input is left to the
caller’s verification, as in torch.linalg.solve. CPU providers may
still report their own exactly singular factor as Error::Singular.
§Errors
Returns Error::Validation for incompatible matrix, batch, or dtype
metadata, Error::Extension for an unsupported dtype or singular
system, and Error::RuntimeState when the backend is unavailable.
§Examples
let x = a.solve(&mut tenferro_cpu::CpuEngine::serial(), &b)?;
assert_eq!(x.value()?.as_slice::<f64>()?, &[2.0, 2.0]);Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".