#[non_exhaustive]pub enum BinaryOp {
Show 15 variants
Add,
Subtract,
Multiply,
Divide,
Maximum,
Minimum,
LogAddExp,
FloorDivide,
Power,
Equal,
NotEqual,
Less,
LessEqual,
Greater,
GreaterEqual,
}Expand description
An element-wise function of two operands.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Add
a + b.
Subtract
a - b.
Multiply
a * b.
Divide
a / b (true division).
Maximum
The larger operand; NaN propagates.
Minimum
The smaller operand; NaN propagates.
LogAddExp
log(exp(a) + exp(b)), computed stably (MLX’s logaddexp); NaN propagates.
FloorDivide
floor(a / b) (MLX’s floor_divide): for floats the floor of the rounded quotient,
for integers the quotient rounded toward negative infinity (0 for a zero divisor,
which MLX leaves undefined).
Power
a to the power b (MLX’s power): pow for floats, repeated squaring for
integers (0 for a negative exponent, which MLX leaves undefined).
Equal
a == b.
NotEqual
a != b.
Less
a < b.
LessEqual
a <= b.
Greater
a > b.
GreaterEqual
a >= b.
Trait Implementations§
impl Copy for BinaryOp
impl Eq for BinaryOp
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§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
impl<T> Boilerplate for T
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,
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