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
Source§fn eq(&self, other: &DotGeneralAccumulation) -> bool
fn eq(&self, other: &DotGeneralAccumulation) -> bool
self and other values to be equal, and is used by ==.