MCPcopy Create free account
hub / github.com/XiaoMi/mace / obfuscate_name

Function obfuscate_name

tools/python/encrypt.py:82–102  ·  view source on GitHub ↗
(net_def)

Source from the content-addressed store, hash-verified

80
81
82def obfuscate_name(net_def):
83 input_nodes = set()
84 for input_node in net_def.input_info:
85 input_nodes.add(input_node.name)
86 output_nodes = set()
87 for output_node in net_def.output_info:
88 output_nodes.add(output_node.name)
89 net_def_names_set = set()
90 tensor_map = generate_tensor_map(net_def.tensors, net_def_names_set)
91 in_out_map = generate_in_out_map(net_def.op, tensor_map, net_def_names_set)
92 for t in net_def.tensors:
93 if t.name not in input_nodes and t.name not in output_nodes:
94 t.name = tensor_map[t.name]
95 for op in net_def.op:
96 for i in range(len(op.input)):
97 if (op.input[i] not in input_nodes) and \
98 (op.input[i] not in output_nodes):
99 op.input[i] = in_out_map[op.input[i]]
100 for i in range(len(op.output)):
101 if op.output[i] not in output_nodes:
102 op.output[i] = in_out_map[op.output[i]]
103
104
105def save_graph_to_code(j2_env, model_tag, graph_idx, graph, output):

Callers 1

encryptFunction · 0.85

Calls 2

generate_tensor_mapFunction · 0.85
generate_in_out_mapFunction · 0.85

Tested by

no test coverage detected