MCPcopy
hub / github.com/OpenPPL/ppq / get_upstream_operations

Method get_upstream_operations

ppq/IR/base/graph.py:324–333  ·  view source on GitHub ↗
(self, operation: Operation)

Source from the content-addressed store, hash-verified

322 return downstream_ops
323
324 def get_upstream_operations(self, operation: Operation) -> List[Operation]:
325 if not isinstance(operation, Operation):
326 raise TypeError(f'Expect an operation instance, however {type(operation)} is given.')
327 if operation.name not in self.operations:
328 raise KeyError(f'Operation {operation.name} not in current graph.')
329 upstream_ops = []
330 for input_var in operation.inputs:
331 if input_var.source_op is not None:
332 upstream_ops.append(input_var.source_op)
333 return upstream_ops
334
335 def topological_sort(self) -> List[Operation]:
336 visited = {operation.name: False for operation in self.operations.values()}

Callers 15

topological_sortMethod · 0.95
ep_exprMethod · 0.80
retrospectMethod · 0.80
merge_fnMethod · 0.80
optimizeMethod · 0.80
optimizeMethod · 0.80
_find_multi_input_epMethod · 0.80
_find_coherent_epMethod · 0.80
initialize_depthMethod · 0.80
remove_activation_opsMethod · 0.80
fuse_bnMethod · 0.80

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected