pub enum BinaryOp {
Show 14 variants
Add,
Sub,
Mul,
Div,
Max,
Min,
Pow,
Mod,
BitAnd,
BitOr,
BitXor,
Shl,
Shr,
Atan2,
}Expand description
Binary element-wise operations.
Variants§
Add
Sub
Mul
Div
Max
Min
Pow
Mod
C fmod (sign of dividend) — matches Rust %. Differentiable in a
(∂/∂a = 1); b treated as the constant modulus (∂/∂b = 0).
BitAnd
Bitwise ops on integer-valued operands (GPU: (int)a op (int)b).
Non-differentiable (zero gradient).
BitOr
BitXor
Shl
Left/right shift: a << b / a >> b on integer-valued operands.
Shr
Atan2
atan2(a, b) — quadrant-aware arctangent (angle of the point (b, a),
i.e. Rust’s a.atan2(b)). Smooth and differentiable in both operands:
∂/∂a = b/(a²+b²), ∂/∂b = -a/(a²+b²). Standalone kernel only (not
region-fusable — the fused-region kernels don’t carry its opcode).
Implementations§
Source§impl BinaryOp
impl BinaryOp
Sourcepub fn region_fusable(self) -> bool
pub fn region_fusable(self) -> bool
Ops that may fold into a fused ElementwiseRegion. The newer ops
(Mod + bitwise) run only on the standalone binary kernel for now — the
per-backend fused-region kernels don’t carry their opcodes yet (a
perf follow-up), and their default would silently mis-evaluate them.
Trait Implementations§
impl Copy for BinaryOp
Source§impl<'de> Deserialize<'de> for BinaryOp
impl<'de> Deserialize<'de> for BinaryOp
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<BinaryOp, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<BinaryOp, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for BinaryOp
Source§impl Serialize for BinaryOp
impl Serialize for BinaryOp
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,
impl StructuralPartialEq for BinaryOp
Auto Trait Implementations§
impl Freeze for BinaryOp
impl RefUnwindSafe for BinaryOp
impl Send for BinaryOp
impl Sync for BinaryOp
impl Unpin for BinaryOp
impl UnsafeUnpin for BinaryOp
impl UnwindSafe for BinaryOp
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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> ⓘ
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> ⓘ
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