pub enum ChainStep {
Activation(Activation, ChainOperand),
Cast(DType, ChainOperand),
Binary(BinaryOp, ChainOperand, ChainOperand),
Compare(CmpOp, ChainOperand, ChainOperand),
Where(ChainOperand, ChainOperand, ChainOperand),
}Expand description
One step in a fused element-wise chain. Each step produces exactly
one scalar result (per element); later steps can refer to it via
ChainOperand::Step. The whole chain runs per element in registers.
Variants§
Activation(Activation, ChainOperand)
Cast(DType, ChainOperand)
Binary(BinaryOp, ChainOperand, ChainOperand)
Compare(CmpOp, ChainOperand, ChainOperand)
Where(ChainOperand, ChainOperand, ChainOperand)
3-input element-wise select: cond ? on_true : on_false. Mirrors
Op::Where inside a chain. cond is treated as truthy iff
non-zero. Lets the optimizer fold attention masks / clamp-style
patterns into a single region kernel instead of breaking the
chain at the first Op::Where.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ChainStep
impl<'de> Deserialize<'de> for ChainStep
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ChainStep, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ChainStep, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for ChainStep
impl Serialize for ChainStep
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for ChainStep
Auto Trait Implementations§
impl Freeze for ChainStep
impl RefUnwindSafe for ChainStep
impl Send for ChainStep
impl Sync for ChainStep
impl Unpin for ChainStep
impl UnsafeUnpin for ChainStep
impl UnwindSafe for ChainStep
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,
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