pub struct Bf16Einsum { /* private fields */ }Expand description
A pairwise contraction in bfloat16.
The labels are the ones an ordinary einsum subscript string names, so "ik,kj->ij" is
(&[0, 1], &[1, 2], &[0, 2]). The operands are widened to f32, the contraction accumulates
there, and the result is rounded to bfloat16 once.
§Examples
use tenferro_bf16_proof::einsum::Bf16Einsum;
let op = Bf16Einsum::new(&[0, 1], &[1, 2], &[0, 2]).expect("a contraction");
assert_eq!(op.labels(), (&[0, 1][..], &[1, 2][..], &[0, 2][..]));Implementations§
Source§impl Bf16Einsum
impl Bf16Einsum
Sourcepub fn new(lhs: &[u32], rhs: &[u32], out: &[u32]) -> Result<Self>
pub fn new(lhs: &[u32], rhs: &[u32], out: &[u32]) -> Result<Self>
Build the pairwise contraction lhs,rhs->out.
§Errors
Returns [tenferro_tensor::Error::InvalidArgument] when the pattern is not a pairwise contraction: an operand
carries no label, a label repeats inside one operand, the operands share no contracted
label, or an output label appears in no operand.
§Examples
use tenferro_bf16_proof::einsum::Bf16Einsum;
assert!(Bf16Einsum::new(&[0, 1], &[1, 2], &[0, 2]).is_ok());
assert!(Bf16Einsum::new(&[], &[1, 2], &[0, 2]).is_err());Trait Implementations§
Source§impl Clone for Bf16Einsum
impl Clone for Bf16Einsum
Source§fn clone(&self) -> Bf16Einsum
fn clone(&self) -> Bf16Einsum
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 Bf16Einsum
impl Debug for Bf16Einsum
impl Eq for Bf16Einsum
Source§impl ExtensionOp for Bf16Einsum
impl ExtensionOp for Bf16Einsum
Source§fn payload_hash(&self, hasher: &mut dyn Hasher)
fn payload_hash(&self, hasher: &mut dyn Hasher)
Hash the payload (everything except
family_id). Read moreSource§fn payload_eq(&self, other: &dyn ExtensionOp) -> bool
fn payload_eq(&self, other: &dyn ExtensionOp) -> bool
Structural equality against another extension value. Read more
Source§fn input_count(&self) -> usize
fn input_count(&self) -> usize
Number of primal inputs. MUST be constant for any given
Arc<dyn ExtensionOp> value.Source§fn output_count(&self) -> usize
fn output_count(&self) -> usize
Number of outputs. MUST match the length of the vector returned by a
successful
Self::infer_output_meta call.Source§fn semantic_effects(&self) -> ExtensionEffectDeclaration<'_>
fn semantic_effects(&self) -> ExtensionEffectDeclaration<'_>
Declare observable semantic effects for this extension payload. Read more
Source§fn semantic_aliases(&self) -> ExtensionAliasDeclaration<'_>
fn semantic_aliases(&self) -> ExtensionAliasDeclaration<'_>
Declare semantic output aliasing for this extension payload. Read more
Source§fn scalar_identity(&self) -> Option<&'static str>
fn scalar_identity(&self) -> Option<&'static str>
Canonical identity of an externally defined scalar this operation carries. Read more
Source§fn infer_output_meta(
&self,
ctx: &mut ExtensionShapeContext<'_>,
) -> Result<Vec<(DType, Vec<SymDim>)>>
fn infer_output_meta( &self, ctx: &mut ExtensionShapeContext<'_>, ) -> Result<Vec<(DType, Vec<SymDim>)>>
Infer output dtypes and shapes for each output slot. Read more
Source§fn lower_to_standard_ops(
&self,
_builder: &mut GraphBuilder<StdTensorOp>,
_inputs: &[ValueRef<StdTensorOp>],
_input_dtypes: &[DType],
_input_shapes: &[&[SymDim]],
) -> Result<ExtensionStandardLowering, ExtensionLoweringError>
fn lower_to_standard_ops( &self, _builder: &mut GraphBuilder<StdTensorOp>, _inputs: &[ValueRef<StdTensorOp>], _input_dtypes: &[DType], _input_shapes: &[&[SymDim]], ) -> Result<ExtensionStandardLowering, ExtensionLoweringError>
Try to expand this extension into standard tensor graph operations. Read more
Source§fn prune_outputs(&self, _live_outputs: &[bool]) -> Option<Arc<dyn ExtensionOp>>
fn prune_outputs(&self, _live_outputs: &[bool]) -> Option<Arc<dyn ExtensionOp>>
Optionally return an equivalent op that produces only live outputs. Read more
Source§impl PartialEq for Bf16Einsum
impl PartialEq for Bf16Einsum
impl StructuralPartialEq for Bf16Einsum
Auto Trait Implementations§
impl Freeze for Bf16Einsum
impl RefUnwindSafe for Bf16Einsum
impl Send for Bf16Einsum
impl Sync for Bf16Einsum
impl Unpin for Bf16Einsum
impl UnsafeUnpin for Bf16Einsum
impl UnwindSafe for Bf16Einsum
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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
Checks if this value is equivalent to the given key. Read more
impl<T, U> Imply<T> for U
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> ⓘ
Converts
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> ⓘ
Converts
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