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

Method append_variable

ppq/IR/base/graph.py:304–312  ·  view source on GitHub ↗
(self, var: Variable)

Source from the content-addressed store, hash-verified

302 self.operations[operation.name] = operation
303
304 def append_variable(self, var: Variable):
305 if not isinstance(var, Variable):
306 raise TypeError(f'You can only insert variable via this function, however {type(var)} was given.')
307 if not all([dest_op.name in self.operations for dest_op in var.dest_ops]):
308 raise KeyError(f'Inserting Variable {var} has a related Operation(dest_op) '\
309 'which are not included in this graph yet, insert such Operations before inserting this.')
310 if var.name in self.variables:
311 raise KeyError(f'Duplicated Variable({var}) was found, rename your Variable before inserting.')
312 self.variables[var.name] = var
313
314 def get_downstream_operations(self, operation: Operation) -> List[Operation]:
315 if not isinstance(operation, Operation):

Callers 6

create_variableMethod · 0.95
copyMethod · 0.95
optimizeMethod · 0.80
format_clipMethod · 0.80
__add_constant_inputMethod · 0.80
fuse_bnMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected