pub struct DotGeneralConfig {
pub lhs_contracting_dims: Vec<usize>,
pub rhs_contracting_dims: Vec<usize>,
pub lhs_batch_dims: Vec<usize>,
pub rhs_batch_dims: Vec<usize>,
}Expand description
DotGeneral dimension configuration.
Records only the dim-numbering roles (contracting / batch; free is derived).
Rank info travels with the enclosing StdTensorOp::DotGeneral variant at
the trace/StdTensorOp layer, and with ExecInstruction::output_shapes at
the exec layer. This separation makes it structurally impossible for
stored ranks to drift from actual tensor ranks (issue #664).
The output shape is [lhs_free..., rhs_free..., batch...] (col-major
batch-trailing convention). Batch dims have the largest stride so that
each batch slice occupies a contiguous block of memory.
§Examples
use tenferro_tensor::DotGeneralConfig;
let config = DotGeneralConfig {
lhs_contracting_dims: vec![1],
rhs_contracting_dims: vec![0],
lhs_batch_dims: vec![],
rhs_batch_dims: vec![],
};Fields§
§lhs_contracting_dims: Vec<usize>§rhs_contracting_dims: Vec<usize>§lhs_batch_dims: Vec<usize>§rhs_batch_dims: Vec<usize>Implementations§
Source§impl DotGeneralConfig
impl DotGeneralConfig
Sourcepub fn validate_dims_with_ranks(
&self,
lhs_rank: usize,
rhs_rank: usize,
) -> Result<(), String>
pub fn validate_dims_with_ranks( &self, lhs_rank: usize, rhs_rank: usize, ) -> Result<(), String>
Validate that all dimension indices are within range for the given explicit ranks and that no axis appears in multiple roles.
Call sites supply the actual operand ranks (from the tensor shapes they have in hand). The config itself carries only the dim-numbering roles.
§Examples
use tenferro_tensor::DotGeneralConfig;
let config = DotGeneralConfig {
lhs_contracting_dims: vec![1],
rhs_contracting_dims: vec![0],
lhs_batch_dims: vec![],
rhs_batch_dims: vec![],
};
config.validate_dims_with_ranks(2, 2).unwrap();Trait Implementations§
Source§impl Clone for DotGeneralConfig
impl Clone for DotGeneralConfig
Source§fn clone(&self) -> DotGeneralConfig
fn clone(&self) -> DotGeneralConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DotGeneralConfig
impl Debug for DotGeneralConfig
Source§impl Hash for DotGeneralConfig
impl Hash for DotGeneralConfig
Source§impl PartialEq for DotGeneralConfig
impl PartialEq for DotGeneralConfig
impl Eq for DotGeneralConfig
impl StructuralPartialEq for DotGeneralConfig
Auto Trait Implementations§
impl Freeze for DotGeneralConfig
impl RefUnwindSafe for DotGeneralConfig
impl Send for DotGeneralConfig
impl Sync for DotGeneralConfig
impl Unpin for DotGeneralConfig
impl UnsafeUnpin for DotGeneralConfig
impl UnwindSafe for DotGeneralConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more