tenzr::Node¶
#include <node.h>
Inherits from std::enable_shared_from_this< Node >
Inherited by tenzr::AddNode, tenzr::ArgSortNode, tenzr::ConcatenateNode, tenzr::ConvertNode, tenzr::ConvolutionNode, tenzr::CustomOpNode, tenzr::DivNode, tenzr::DynamicSliceNode, tenzr::DynamicUpdateSliceNode, tenzr::GatherNode, tenzr::MatmulNode, tenzr::MulNode, tenzr::PadNode, tenzr::ReduceNode, tenzr::ReduceWindowNode, tenzr::ReluNode, tenzr::ReshapeNode, tenzr::ScatterNode, tenzr::SigmoidNode, tenzr::SliceNode, tenzr::SubNode, tenzr::TransposeNode, tenzr::VariableNode
Public Functions¶
| Name | |
|---|---|
| Node(NodeKind kind, Shape shape, DType dtype, ShardingSpec sharding =ShardingSpec::Replicated()) | |
| virtual | ~Node() =default |
| NodeKind | Kind() const The node's operation kind. |
| const Shape & | shape() const The node's output shape. |
| DType | Dtype() const The node's output dtype. |
| const ShardingSpec & | Sharding() const The node's sharding spec. |
| void | SetSharding(ShardingSpec spec) Replace the sharding spec. |
| const StridedLayout & | Layout() const The node's strided layout. |
| void | SetLayout(StridedLayout layout) Replace the layout. |
| const std::vector< std::shared_ptr< Node > > & | Inputs() const The node's input operands. |
| uint64_t | Id() const The node's unique id. |
| virtual std::string | OpName() const =0 StableHLO-style name of this node's operation. |
Protected Functions¶
| Name | |
|---|---|
| uint64_t | NextId() |
Protected Attributes¶
| Name | |
|---|---|
| NodeKind | kind_ |
| Shape | shape_ |
| DType | dtype_ |
| ShardingSpec | sharding_ |
| StridedLayout | layout_ |
| std::vector< std::shared_ptr< Node > > | inputs_ |
| uint64_t | id_ |
Detailed Description¶
Base class for nodes in the lazy expression graph. Each concrete node carries its operation kind, output shape, dtype, sharding, layout, and input operands.
Public Functions Documentation¶
function Node¶
Parameters:
- kind Node kind.
- shape Output shape.
- dtype Output dtype.
- sharding Output sharding.
Initialize a node with its kind, shape, dtype, and sharding.
function ~Node¶
function Kind¶
The node's operation kind.
function shape¶
The node's output shape.
function Dtype¶
The node's output dtype.
function Sharding¶
The node's sharding spec.
function SetSharding¶
Replace the sharding spec.
function Layout¶
The node's strided layout.
function SetLayout¶
Replace the layout.
function Inputs¶
The node's input operands.
function Id¶
The node's unique id.
function OpName¶
StableHLO-style name of this node's operation.
Reimplemented by: tenzr::VariableNode::OpName, tenzr::AddNode::OpName, tenzr::MulNode::OpName, tenzr::SubNode::OpName, tenzr::DivNode::OpName, tenzr::MatmulNode::OpName, tenzr::ConvolutionNode::OpName, tenzr::ReshapeNode::OpName, tenzr::TransposeNode::OpName, tenzr::SliceNode::OpName, tenzr::PadNode::OpName, tenzr::GatherNode::OpName, tenzr::ScatterNode::OpName, tenzr::DynamicSliceNode::OpName, tenzr::DynamicUpdateSliceNode::OpName, tenzr::ArgSortNode::OpName, tenzr::ConcatenateNode::OpName, tenzr::ReluNode::OpName, tenzr::SigmoidNode::OpName, tenzr::CustomOpNode::OpName, tenzr::ConvertNode::OpName, tenzr::ReduceNode::OpName, tenzr::ReduceWindowNode::OpName
Protected Functions Documentation¶
function NextId¶
Return: The new id.
Allocate a fresh, process-unique node id.