pub enum GradOp {
Show 34 variants
Input,
Parameter,
Add(usize, usize),
Sub(usize, usize),
Mul(usize, usize),
Div(usize, usize),
Neg(usize),
MatMul(usize, usize),
Sum(usize),
Mean(usize),
ScalarMul(usize, f64),
Exp(usize),
Ln(usize),
StructField {
parent: usize,
field_index: usize,
total_fields: usize,
},
MapLookup {
map_node: usize,
key_index: usize,
total_keys: usize,
},
Sin(usize),
Cos(usize),
Sqrt(usize),
Pow(usize, f64),
Sigmoid(usize),
Relu(usize),
TanhAct(usize),
Abs(usize),
Log2(usize),
Softmax(usize),
CrossEntropy {
logits: usize,
targets: usize,
},
LayerNorm(usize),
BatchNorm(usize),
Clamp {
input: usize,
min: f64,
max: f64,
},
Where {
cond: usize,
on_true: usize,
on_false: usize,
},
Reshape {
input: usize,
original_shape: Vec<usize>,
},
TransposeOp(usize),
CatOp {
inputs: Vec<usize>,
axis: usize,
sizes: Vec<usize>,
},
GatherOp {
input: usize,
indices: Vec<usize>,
axis: usize,
},
}Expand description
Operation recorded in the computation graph.
Variants§
Input
Parameter
Add(usize, usize)
Sub(usize, usize)
Mul(usize, usize)
Div(usize, usize)
Neg(usize)
MatMul(usize, usize)
Sum(usize)
Mean(usize)
ScalarMul(usize, f64)
Exp(usize)
Ln(usize)
StructField
Gradient through struct field access: parent node, field index.
MapLookup
Gradient through map lookup: map node, key index in insertion order.
Sin(usize)
Cos(usize)
Sqrt(usize)
Pow(usize, f64)
Sigmoid(usize)
Relu(usize)
TanhAct(usize)
Abs(usize)
Log2(usize)
Softmax(usize)
CrossEntropy
Cross-entropy loss: CrossEntropy(logits, targets)
LayerNorm(usize)
Layer normalization: LayerNorm(input); stores normalized output and std for backward
BatchNorm(usize)
Batch normalization: BatchNorm(input); stores normalized output and std for backward
Clamp
Clamp to [min, max]
Where
Conditional select: Where(condition, on_true, on_false) condition is a tensor of 0.0/1.0 masks
Reshape
Reshape with stored original shape for backward
TransposeOp(usize)
Transpose (2-D)
CatOp
Concatenation along axis with sizes for splitting on backward
GatherOp
Gather along axis: GatherOp { input, indices, axis }
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GradOp
impl RefUnwindSafe for GradOp
impl Send for GradOp
impl Sync for GradOp
impl Unpin for GradOp
impl UnsafeUnpin for GradOp
impl UnwindSafe for GradOp
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