Skip to content
Snippets Groups Projects

Resolve "Specify internal input/output dependencies of an Operation"

1 unresolved thread
3 files
+ 50
36
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 4
8
@@ -181,10 +181,8 @@ class Operation(GraphComponent, SignalSourceProvider):
raise NotImplementedError
@abstractmethod
def depends(self, output_index: int, input_index: int) -> bool:
"""Check if the output at the given output index depends on the input at the
given input index in order to be evaluated.
"""
def inputs_required_for_output(self, output_index: int) -> Iterable[int]:
"""Get the input indices of all inputs in this operation whose values are required in order to evalueate the output at the given output index."""
raise NotImplementedError
@@ -347,12 +345,10 @@ class AbstractOperation(Operation, AbstractGraphComponent):
pass
return [self]
def depends(self, output_index: int, input_index: int) -> bool:
def inputs_required_for_output(self, output_index: int) -> Iterable[int]:
if output_index < 0 or output_index >= self.output_count:
raise IndexError(f"Output index out of range (expected 0-{self.output_count - 1}, got {output_index})")
if input_index < 0 or input_index >= self.input_count:
raise IndexError(f"Input index out of range (expected 0-{self.input_count - 1}, got {input_index})")
return True # By default, assume each output depends on all inputs.
return [i for i in range(self.input_count)] # By default, assume each output depends on all inputs.
@property
def neighbors(self) -> Iterable[GraphComponent]:
Loading