def __from_inputs(): mapped_inputs = [ nndct_utils.node_from_output(i, self.get_model_type()) for i in inputs ] for node in self.__Nndctgraph.nodes: if all(i in node.inputs for i in mapped_inputs): return node raise KeyError( "node with inputs {}(map to {}) do not exist in Graph, please check!" .format(inputs, mapped_inputs))
def quant_inputs(self, node_or_name, inputs, params=None, validate=True): node = self._find_node(node_or_name) valid_inputs = [] for i in inputs: try: input_node = self.get_Nndctnode( node_name=nndct_utils.node_from_output( i, self.get_model_type())) except KeyError: valid_inputs.append(None) continue if input_node.op.type == NNDCT_OP.INPUT: valid_input = input_node.name valid_inputs.append(valid_input) else: valid_inputs.append(None) return valid_inputs