pub enum Node {
Show 25 variants
Detach(Id),
Leaf(Shape, DType),
Uniform(Shape, DType),
Cast(Id, DType),
Neg(Id),
ReLU(Id),
Sin(Id),
Cos(Id),
Ln(Id),
Exp(Id),
Tanh(Id),
Sqrt(Id),
Add(Id, Id),
Sub(Id, Id),
Mul(Id, Id),
Div(Id, Id),
Pow(Id, Id),
Cmplt(Id, Id),
Where(Id, Id, Id),
Reshape(Id, Shape),
Expand(Id, Shape),
Permute(Id, Axes, Shape),
Pad(Id, Box<[(i64, i64)]>, Shape),
Sum(Id, Axes, Shape),
Max(Id, Axes, Shape),
}
Expand description
Node representing different possible tensors
Variants§
Detach(Id)
Detach tensor from tape
Leaf(Shape, DType)
Leaf that is guaranteed to be evaluated
Uniform(Shape, DType)
Uniform initializer for range 0..1
Cast(Id, DType)
Cast to dtype unary op
Neg(Id)
Neg unary op
ReLU(Id)
ReLU unary op
Sin(Id)
Sine unary op
Cos(Id)
Cosine unary op
Ln(Id)
Natural logarithm unary op
Exp(Id)
Exp unary op
Tanh(Id)
Hyperbolic tangent unary op
Sqrt(Id)
Square root unary op
Add(Id, Id)
Addition binary op
Sub(Id, Id)
Subtraction binary op
Mul(Id, Id)
Multiplication binary op
Div(Id, Id)
Division binary op
Pow(Id, Id)
Exponentiation binary op
Cmplt(Id, Id)
Compare less than binary op
Where(Id, Id, Id)
Where op
Reshape(Id, Shape)
Reshape movement op
Expand(Id, Shape)
Expand movement op
Permute(Id, Axes, Shape)
Permute movement op
Pad(Id, Box<[(i64, i64)]>, Shape)
Pad movement op
Sum(Id, Axes, Shape)
Sum reduce op
Max(Id, Axes, Shape)
Max reduce op
Implementations§
source§impl Node
impl Node
sourcepub const fn num_parameters(&self) -> u8
pub const fn num_parameters(&self) -> u8
Get number of parameters of self. This method does not allocate.
sourcepub const fn parameters(&self) -> impl Iterator<Item = Id>
pub const fn parameters(&self) -> impl Iterator<Item = Id>
Get all parameters of self. This method does not allocate.
sourcepub fn flop(&self, nodes: &[Node]) -> usize
pub fn flop(&self, nodes: &[Node]) -> usize
Get number of operations necessary to calculate this node
sourcepub fn parameters_contain(&self, nid: Id) -> bool
pub fn parameters_contain(&self, nid: Id) -> bool
Check if parameters of self contains nid.