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

Method append_operation

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

Source from the content-addressed store, hash-verified

292 return self._detail
293
294 def append_operation(self, operation: Operation):
295 if not isinstance(operation, Operation):
296 raise TypeError(f'You can only insert operations via this function, however {type(operation)} was given.')
297 if not all([var.name in self.variables for var in operation.inputs + operation.outputs]):
298 raise KeyError(f'Inserting Operation {operation} has a related variable '\
299 'which are not included in this graph yet, insert such variables before inserting this.')
300 if operation.name in self.operations:
301 raise KeyError(f'Duplicated Operation({operation}) was found, rename your Operation before inserting.')
302 self.operations[operation.name] = operation
303
304 def append_variable(self, var: Variable):
305 if not isinstance(var, Variable):

Callers 6

insert_op_on_varMethod · 0.95
create_operationMethod · 0.95
copyMethod · 0.95
fuse_bnMethod · 0.80
test_graph_api.pyFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected