diff --git a/tools/python/encrypt.py b/tools/python/encrypt.py index b612d65487d88a5e94f13a2675ea03c13c01ccbf..6a28fe2f5deef0ff6ba663fe4eab80e66b2cdde0 100644 --- a/tools/python/encrypt.py +++ b/tools/python/encrypt.py @@ -94,7 +94,8 @@ def obfuscate_name(model): t.name = tensor_map[t.name] for op in model.op: for i in range(len(op.input)): - if op.input[i] not in input_nodes: + if (op.input[i] not in input_nodes) and \ + (op.input[i] not in output_nodes): op.input[i] = in_out_map[op.input[i]] for i in range(len(op.output)): if op.output[i] not in output_nodes: diff --git a/tools/sh_commands.py b/tools/sh_commands.py index 774a287bffc0a43b3b0a84829e9de06d0c40ccab..4b02948549faad746e6ef5e6c01ad9d4ae60de6a 100644 --- a/tools/sh_commands.py +++ b/tools/sh_commands.py @@ -478,80 +478,6 @@ def merge_opencl_parameters(binaries_dirs, np.array(output_byte_array).tofile(output_file_path) -def gen_model_code(model_codegen_dir, - platform, - model_file_path, - weight_file_path, - model_sha256_checksum, - weight_sha256_checksum, - input_nodes, - input_data_types, - input_data_formats, - output_nodes, - output_data_types, - output_data_formats, - check_nodes, - runtime, - model_tag, - input_shapes, - input_ranges, - output_shapes, - check_shapes, - dsp_mode, - embed_model_data, - winograd, - quantize, - quantize_large_weights, - quantize_range_file, - change_concat_ranges, - obfuscate, - model_graph_format, - data_type, - cl_mem_type, - graph_optimize_options): - bazel_build_common("//mace/python/tools:converter") - - if os.path.exists(model_codegen_dir): - sh.rm("-rf", model_codegen_dir) - sh.mkdir("-p", model_codegen_dir) - - sh.python("bazel-bin/mace/python/tools/converter", - "-u", - "--platform=%s" % platform, - "--model_file=%s" % model_file_path, - "--weight_file=%s" % weight_file_path, - "--model_checksum=%s" % model_sha256_checksum, - "--weight_checksum=%s" % weight_sha256_checksum, - "--input_node=%s" % input_nodes, - "--input_data_types=%s" % input_data_types, - "--input_data_formats=%s" % input_data_formats, - "--output_node=%s" % output_nodes, - "--output_data_types=%s" % output_data_types, - "--output_data_formats=%s" % output_data_formats, - "--check_node=%s" % check_nodes, - "--runtime=%s" % runtime, - "--template=%s" % "mace/python/tools", - "--model_tag=%s" % model_tag, - "--input_shape=%s" % input_shapes, - "--input_range=%s" % input_ranges, - "--output_shape=%s" % output_shapes, - "--check_shape=%s" % check_shapes, - "--dsp_mode=%s" % dsp_mode, - "--embed_model_data=%s" % embed_model_data, - "--winograd=%s" % winograd, - "--quantize=%s" % quantize, - "--quantize_large_weights=%s" % quantize_large_weights, - "--quantize_range_file=%s" % quantize_range_file, - "--change_concat_ranges=%s" % change_concat_ranges, - "--obfuscate=%s" % obfuscate, - "--output_dir=%s" % model_codegen_dir, - "--model_graph_format=%s" % model_graph_format, - "--data_type=%s" % data_type, - "--graph_optimize_options=%s" % graph_optimize_options, - "--cl_mem_type=%s" % cl_mem_type, - _fg=True) - - def gen_input(model_output_dir, input_nodes, input_shapes,