Index
Access
dataclass
¶
Bases: EinsumExpression, EinsumTree
Access
Tensor access like a[i, j].
Attributes:
| Name | Type | Description |
|---|---|---|
tensor |
The tensor to access. |
|
idxs |
tuple[Index, ...]
|
The indices at which to access the tensor. |
Source code in src/finch/finch_einsum/nodes.py
Alias
dataclass
¶
Bases: EinsumExpression
Represents a AST expression for an index named name.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
The name of the index. |
Source code in src/finch/finch_einsum/nodes.py
Call
dataclass
¶
Bases: EinsumExpression, EinsumTree
Call
Represents an operation like + or * on pointwise expressions for multiple operands. If operation is not commutative, pointwise node must be binary, with 2 args at most.
Attributes:
| Name | Type | Description |
|---|---|---|
op |
Literal
|
The function to apply e.g., ffunc.add, ffunc.mul, ffunc.subtract, ffunc.div, etc... Must be a callable. |
args |
tuple[EinsumExpression, ...]
|
The arguments to the operation. |
Source code in src/finch/finch_einsum/nodes.py
Einsum
dataclass
¶
Bases: EinsumTree, EinsumStatement
Einsum
A einsum operation that maps pointwise expressions and aggregates them.
Attributes:
| Name | Type | Description |
|---|---|---|
op |
Literal
|
The function to apply to the pointwise expressions (e.g. +=, f=, max=, etc...). |
idxs |
tuple[Index, ...]
|
The indices that are used in the output (i.e. i, j). |
arg |
EinsumExpression
|
The pointwise expression that is mapped and aggregated. |
Source code in src/finch/finch_einsum/nodes.py
EinsumEvaluator
¶
Bases: Stage
Source code in src/finch/finch_einsum/stages.py
lower(term, bindings=None)
abstractmethod
¶
EinsumExpression
¶
Bases: EinsumNode, ABC
Einsum AST expression base class.
Represents a pointwise expression in the Einsum IR, which evaluates to a scalar.
Source code in src/finch/finch_einsum/nodes.py
EinsumLoader
¶
Bases: Stage
Source code in src/finch/finch_einsum/stages.py
lower(term, bindings, *, defined=None)
abstractmethod
¶
Generate Finch Library from the given logic and input types, with a
single method called main which implements the logic. Also return a
dictionary including additional tables needed to run the kernel.
Aliases in defined are defined by the program and have no input value.
Source code in src/finch/finch_einsum/stages.py
EinsumNode
¶
Bases: Term
Source code in src/finch/finch_einsum/nodes.py
__str__()
¶
EinsumStatement
¶
Bases: EinsumNode
Einsum AST statement base class.
Represents a statement in the Einsum IR. An Einsum statement may modify the state of the machine by assigning tensor values to variables. Einsum statements evaluate to a tuple of tensor values.
Source code in src/finch/finch_einsum/nodes.py
Index
dataclass
¶
Bases: EinsumExpression
Represents a AST expression for an index named name.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
The name of the index. |
Source code in src/finch/finch_einsum/nodes.py
Literal
dataclass
¶
Plan
dataclass
¶
Bases: EinsumTree, EinsumStatement
Plan
A plan that contains einsum operations. Basically a list of einsums and some return values.
Source code in src/finch/finch_einsum/nodes.py
Produces
dataclass
¶
Bases: EinsumTree, EinsumStatement
Represents a logical AST statement that returns args... from the current plan.
Halts execution of the program.
Attributes:
| Name | Type | Description |
|---|---|---|
args |
tuple[Alias, ...]
|
The arguments to return. |
Source code in src/finch/finch_einsum/nodes.py
children
property
¶
Returns the children of the node.