pub struct Df64Expand {
pub shape: Box<[usize]>,
}Expand description
Broadcast a scalar external value to a declared shape.
The total sum’s adjoint needs to place the output cotangent back into the input’s shape, and a preset broadcast is not available for a scalar tenferro does not declare, so the contribution owns this operation too.
§Examples
use tenferro_df64_proof::extension::Df64Expand;
use tenferro_ad::extension::ExtensionOp;
let expand = Df64Expand::new(vec![2, 3]);
assert_eq!(<Df64Expand as ExtensionOp>::family_id(&expand), "tenferro-df64-proof.df64_ops.v1");
assert_eq!(&*expand.shape, &[2, 3]);Fields§
§shape: Box<[usize]>Shape the scalar is broadcast to.
Implementations§
Trait Implementations§
Source§impl Clone for Df64Expand
impl Clone for Df64Expand
Source§fn clone(&self) -> Df64Expand
fn clone(&self) -> Df64Expand
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 Df64Expand
impl Debug for Df64Expand
Source§impl ExtensionOp for Df64Expand
impl ExtensionOp for Df64Expand
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
Auto Trait Implementations§
impl Freeze for Df64Expand
impl RefUnwindSafe for Df64Expand
impl Send for Df64Expand
impl Sync for Df64Expand
impl Unpin for Df64Expand
impl UnsafeUnpin for Df64Expand
impl UnwindSafe for Df64Expand
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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