pub trait EinsumInputs: Sealed {
type Repr: Repr;
// Required method
fn reads(&self) -> Vec<TensorRead<'_>>;
}Expand description
The input list of a concrete einsum: a slice or array of values that
implement AsView with one representation. Mix owned tensors and views
by borrowing every element ([a.as_read(), b]); that copies no data.
§Examples
use tenferro_einsum::EinsumInputs;
use tenferro_tensor::Tensor;
let a = Tensor::from_vec_col_major(vec![2], vec![1.0_f64, 2.0])?;
let inputs = [&a, &a];
assert_eq!(inputs.reads().len(), 2);Required Associated Types§
Required Methods§
Sourcefn reads(&self) -> Vec<TensorRead<'_>>
fn reads(&self) -> Vec<TensorRead<'_>>
Borrow every input; metadata only, never copies element data.
§Examples
use tenferro_einsum::EinsumInputs;
use tenferro_tensor::Tensor;
let a = Tensor::from_vec_col_major(vec![2], vec![1.0_f64, 2.0])?;
let b = Tensor::from_vec_col_major(vec![3], vec![1.0_f64, 2.0, 3.0])?;
let inputs = vec![a, b];
let reads = inputs.reads();
assert_eq!(reads[0].shape(), &[2]);
assert_eq!(reads[1].shape(), &[3]);Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".