pub struct DotGeneralAccumulation {
pub lhs_conj: bool,
pub rhs_conj: bool,
pub alpha: ContractionScalar,
pub beta: ContractionScalar,
}Expand description
Output-update semantics for dot-general accumulation.
This keeps contraction axes in DotGeneralConfig and output update
semantics here, so cached and non-cached backend traits can share the same
accumulation contract.
§Examples
use tenferro_tensor::{ContractionScalar, DotGeneralAccumulation, DType};
let accum = DotGeneralAccumulation::overwrite(DType::F64).unwrap();
assert_eq!(accum.alpha, ContractionScalar::F64(1.0));
assert_eq!(accum.beta, ContractionScalar::F64(0.0));Fields§
§lhs_conj: bool§rhs_conj: bool§alpha: ContractionScalar§beta: ContractionScalarImplementations§
Source§impl DotGeneralAccumulation
impl DotGeneralAccumulation
Sourcepub fn overwrite(dtype: DType) -> Result<Self>
pub fn overwrite(dtype: DType) -> Result<Self>
Return overwrite semantics, out = lhs dot rhs, for dtype.
§Examples
use tenferro_tensor::{ContractionScalar, DotGeneralAccumulation, DType};
let accum = DotGeneralAccumulation::overwrite(DType::F64).unwrap();
assert_eq!(accum.alpha, ContractionScalar::F64(1.0));
assert_eq!(accum.beta, ContractionScalar::F64(0.0));§Errors
Returns crate::Error::Validation with a
crate::ValidationError::DTypeMismatch source when dtype does not
support contraction scalar identities.
Sourcepub fn add_to(dtype: DType) -> Result<Self>
pub fn add_to(dtype: DType) -> Result<Self>
Return additive update semantics, out += lhs dot rhs, for dtype.
§Examples
use tenferro_tensor::{ContractionScalar, DType, DotGeneralAccumulation};
let accum = DotGeneralAccumulation::add_to(DType::F64)?;
assert_eq!(accum.alpha, ContractionScalar::F64(1.0));
assert_eq!(accum.beta, ContractionScalar::F64(1.0));§Errors
Returns crate::Error::Validation with a
crate::ValidationError::DTypeMismatch source when dtype does not
support contraction scalar identities.
Sourcepub fn scaled(alpha: ContractionScalar, beta: ContractionScalar) -> Result<Self>
pub fn scaled(alpha: ContractionScalar, beta: ContractionScalar) -> Result<Self>
Return scaled update semantics, out = alpha * lhs dot rhs + beta * out.
§Examples
use tenferro_tensor::{ContractionScalar, DotGeneralAccumulation};
let accum = DotGeneralAccumulation::scaled(
ContractionScalar::F32(0.5),
ContractionScalar::F32(2.0),
)?;
assert_eq!(accum.alpha, ContractionScalar::F32(0.5));§Errors
Returns crate::Error::Validation with a
crate::ValidationError::DTypeMismatch source when alpha and beta
have different dtypes.
Trait Implementations§
Source§impl Clone for DotGeneralAccumulation
impl Clone for DotGeneralAccumulation
Source§fn clone(&self) -> DotGeneralAccumulation
fn clone(&self) -> DotGeneralAccumulation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for DotGeneralAccumulation
Source§impl Debug for DotGeneralAccumulation
impl Debug for DotGeneralAccumulation
Source§impl PartialEq for DotGeneralAccumulation
impl PartialEq for DotGeneralAccumulation
impl StructuralPartialEq for DotGeneralAccumulation
Auto Trait Implementations§
impl Freeze for DotGeneralAccumulation
impl RefUnwindSafe for DotGeneralAccumulation
impl Send for DotGeneralAccumulation
impl Sync for DotGeneralAccumulation
impl Unpin for DotGeneralAccumulation
impl UnsafeUnpin for DotGeneralAccumulation
impl UnwindSafe for DotGeneralAccumulation
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,
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