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.
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));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));Trait Implementations§
Source§impl Clone for DotGeneralAccumulation
impl Clone for DotGeneralAccumulation
Source§fn clone(&self) -> DotGeneralAccumulation
fn clone(&self) -> DotGeneralAccumulation
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DotGeneralAccumulation
impl Debug for DotGeneralAccumulation
Source§impl PartialEq for DotGeneralAccumulation
impl PartialEq for DotGeneralAccumulation
Source§fn eq(&self, other: &DotGeneralAccumulation) -> bool
fn eq(&self, other: &DotGeneralAccumulation) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy 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
Mutably borrows from an owned value. Read more