#[non_exhaustive]pub enum Primitive {
Unary(UnaryOp),
Binary(BinaryOp),
Select,
AsType(DType),
Reshape(Vec<usize>),
Transpose(Vec<usize>),
Slice {
start: Vec<usize>,
step: Vec<isize>,
len: Vec<usize>,
},
Broadcast(Vec<usize>),
Reduce {
op: ReduceOp,
axes: Vec<usize>,
},
ArgReduce {
op: ArgReduceOp,
axis: usize,
},
Matmul,
}Expand description
An operation recorded in the graph, with its parameters.
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.
Unary(UnaryOp)
Element-wise function of one operand.
Binary(BinaryOp)
Element-wise function of two operands of equal shape and dtype.
Select
where(condition, a, b): a boolean condition selects from a or b.
AsType(DType)
Conversion to another element type.
Reshape(Vec<usize>)
The same elements in another shape. A view when the layout permits, else a copy.
Transpose(Vec<usize>)
Axes reordered: output axis i is input axis axes[i]. A view.
Slice
A normalised slice per dimension. A view.
Fields
Broadcast(Vec<usize>)
Presented as a larger shape with zero strides. A view.
Reduce
Reduction over sorted, unique axes; reduced dimensions become size 1.
ArgReduce
Index of an extreme value along axis (uint32); the axis becomes size 1.
Matmul
Batched matrix product of [B..., M, K] and [B..., K, N] with equal batch
dimensions.
Implementations§
Trait Implementations§
impl Eq for Primitive
impl StructuralPartialEq for Primitive
Auto Trait Implementations§
impl Freeze for Primitive
impl RefUnwindSafe for Primitive
impl Send for Primitive
impl Sync for Primitive
impl Unpin for Primitive
impl UnsafeUnpin for Primitive
impl UnwindSafe for Primitive
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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