Skip to content

stages

EinsumEvaluator

Bases: Stage

Source code in src/finch/finch_einsum/stages.py
class EinsumEvaluator(Stage):
    @abstractmethod
    def lower(
        self,
        term: ein.EinsumNode,
        bindings: dict[ein.Alias, Any] | None = None,
    ):  # TODO eventually Any->Tensor
        """
        Evaluate the given logic.
        """

lower(term, bindings=None) abstractmethod

Evaluate the given logic.

Source code in src/finch/finch_einsum/stages.py
@abstractmethod
def lower(
    self,
    term: ein.EinsumNode,
    bindings: dict[ein.Alias, Any] | None = None,
):  # TODO eventually Any->Tensor
    """
    Evaluate the given logic.
    """

EinsumLoader

Bases: Stage

Source code in src/finch/finch_einsum/stages.py
class EinsumLoader(Stage):
    @abstractmethod
    def lower(
        self,
        term: ein.EinsumStatement,
        bindings: dict[ein.Alias, TensorFType],
        *,
        defined: set[ein.Alias] | None = None,
    ):
        """
        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.
        """

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
@abstractmethod
def lower(
    self,
    term: ein.EinsumStatement,
    bindings: dict[ein.Alias, TensorFType],
    *,
    defined: set[ein.Alias] | None = None,
):
    """
    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.
    """

EinsumTransform

Bases: Stage

Source code in src/finch/finch_einsum/stages.py
class EinsumTransform(Stage):
    @abstractmethod
    def lower(
        self, term: ein.EinsumStatement, bindings: dict[ein.Alias, TensorFType]
    ) -> tuple[ein.EinsumStatement, dict[ein.Alias, TensorFType]]:
        """
        Transform the given logic term into another logic term.
        """

lower(term, bindings) abstractmethod

Transform the given logic term into another logic term.

Source code in src/finch/finch_einsum/stages.py
@abstractmethod
def lower(
    self, term: ein.EinsumStatement, bindings: dict[ein.Alias, TensorFType]
) -> tuple[ein.EinsumStatement, dict[ein.Alias, TensorFType]]:
    """
    Transform the given logic term into another logic term.
    """