Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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,
)

Expand All @@ -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,
)

Expand Down
17 changes: 0 additions & 17 deletions src/tensora/iteration_graph/iteration_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand All @@ -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(),
)

Expand All @@ -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

Expand Down Expand Up @@ -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)
Loading