diff --git a/src/tensora/iteration_graph/identifiable_expression/_extract_context.py b/src/tensora/iteration_graph/identifiable_expression/_extract_context.py index 315984d..9d044d7 100644 --- a/src/tensora/iteration_graph/identifiable_expression/_extract_context.py +++ b/src/tensora/iteration_graph/identifiable_expression/_extract_context.py @@ -16,7 +16,6 @@ class Context: sparse_leaves: list[TensorLayer] = field(default_factory=list) dense_leaves: list[TensorLayer] = field(default_factory=list) indexes: frozenset[str] = frozenset() - has_output: bool = False has_assemble: bool = False def add(self, other: Context) -> Context: @@ -25,7 +24,6 @@ def add(self, other: Context) -> Context: sparse_leaves=self.sparse_leaves + other.sparse_leaves, dense_leaves=self.dense_leaves + other.dense_leaves, indexes=self.indexes | other.indexes, - has_output=self.has_output or other.has_output, has_assemble=self.has_assemble or other.has_assemble, ) @@ -35,7 +33,6 @@ def multiply(self, other: Context) -> Context: sparse_leaves=self.sparse_leaves + other.sparse_leaves, dense_leaves=self.dense_leaves + other.dense_leaves, indexes=self.indexes | other.indexes, - has_output=self.has_output or other.has_output, has_assemble=self.has_assemble or other.has_assemble, ) diff --git a/src/tensora/iteration_graph/iteration_graph.py b/src/tensora/iteration_graph/iteration_graph.py index 23c9a50..c9c022d 100644 --- a/src/tensora/iteration_graph/iteration_graph.py +++ b/src/tensora/iteration_graph/iteration_graph.py @@ -34,10 +34,6 @@ def compressed_dimensions(self) -> StableFrozenSet[str]: def later_indexes(self) -> frozenset[str]: raise NotImplementedError() - @abstractmethod - def has_output(self) -> bool: - raise NotImplementedError() - @dataclass(frozen=True) class TerminalNode(IterationGraph): @@ -59,9 +55,6 @@ def compressed_dimensions(self) -> StableFrozenSet[str]: def later_indexes(self) -> frozenset[str]: return frozenset() - def has_output(self) -> bool: - return False - @dataclass(frozen=True) class IterationNode(IterationGraph): @@ -78,7 +71,6 @@ def extract_context(self, index: str) -> Context: return replace( next_context, indexes=next_context.indexes | frozenset([self.index_variable]), - has_output=next_context.has_output or self.output is not None, has_assemble=next_context.has_assemble or self.is_sparse_output(), ) @@ -99,18 +91,12 @@ def dense_leaves(self) -> list[TensorLayer]: def is_sparse_input(self) -> bool: return self.context.is_sparse - def is_dense_output(self) -> bool: - return self.output is not None and self.output.mode == Mode.dense - def is_sparse_output(self) -> bool: return self.output is not None and self.output.mode == Mode.compressed def later_indexes(self) -> frozenset[str]: return self.context.indexes - def has_output(self) -> bool: - return self.context.has_output - def has_assemble(self) -> bool: return self.context.has_assemble @@ -149,6 +135,3 @@ def compressed_dimensions(self) -> StableFrozenSet[str]: def later_indexes(self) -> frozenset[str]: return frozenset.union(*(term.later_indexes() for term in self.terms)) - - def has_output(self) -> bool: - return any(term.has_output() for term in self.terms)