def get_handler_name(node_kind): if node_kind is None: return node_kind else: if len(node_kind) <= 4: return node_kind.lower() else: return get_lower_case(node_kind)
def dump(self, code_output_dir): if not os.path.exists(code_output_dir): os.makedirs(code_output_dir) file_name = get_lower_case(self.graph.name) code_output_path = os.path.join(code_output_dir, file_name + '.py') data_output_path = os.path.join(code_output_dir, file_name + '.npy') with open(code_output_path, 'w') as f: f.write(self.emit()) with open(data_output_path, 'wb') as f: np.save(f, self.data) return code_output_path, data_output_path
def dump(self, code_output_dir): if not os.path.exists(code_output_dir): os.makedirs(code_output_dir) file_name = get_lower_case(self.graph.name) code_output_path = os.path.join(code_output_dir, file_name + '.py') data_output_path = os.path.join(code_output_dir, file_name + '.npy') with open(code_output_path, 'w') as f: f.write(self.emit()) with open(data_output_path, 'wb') as f: np.save(f, self.data) return code_output_path, data_output_path
def transform_graph(self): for node in self.graph.nodes: self.layer_name_map[node.name] = node.name ret = [] for node in self.graph.nodes: mapped_node = self.map_node(node) if isinstance(mapped_node, list): ret.extend([n for n in mapped_node]) else: ret.append(mapped_node) name = get_upper_case(get_lower_case(self.graph.name)) return Graph(name, ret)
def transform_graph(self): for node in self.graph.nodes: self.layer_name_map[node.name] = node.name ret = [] for node in self.graph.nodes: mapped_node = self.map_node(node) if isinstance(mapped_node, list): ret.extend([n for n in mapped_node]) elif mapped_node: ret.append(mapped_node) name = get_upper_case(get_lower_case(self.graph.name)) return Graph(name, ret)
def get_handler_name(node_kind): return node_kind.lower() if len(node_kind) <= 4 else get_lower_case( node_kind)
def get_handler_name(node_kind): return node_kind.lower() if len(node_kind) <= 4 else get_lower_case(node_kind)