(flags, args, original_conf)
| 90 | |
| 91 | |
| 92 | def run_layers_validate(flags, args, original_conf): |
| 93 | model_name = flags.model_name |
| 94 | original_model_dir = flags.output + "/" + \ |
| 95 | original_conf['library_name'] + "/model" |
| 96 | model_dir = "/tmp/micro_run/model" |
| 97 | device.execute("mkdir -p %s" % model_dir) |
| 98 | device.execute("cp -p %s/%s.pb %s" % |
| 99 | (original_model_dir, model_name, model_dir)) |
| 100 | params_file_path = "%s/%s.data" % (original_model_dir, model_name) |
| 101 | output_configs = layers_validate.get_layers( |
| 102 | model_dir, model_name, flags.layers) |
| 103 | |
| 104 | for i in range(len(output_configs)): |
| 105 | sub_model_conf = gen_sub_model_conf( |
| 106 | output_configs[i], flags, original_conf) |
| 107 | print(output_configs[i]['model_file_path']) |
| 108 | with open(output_configs[i]['model_file_path'], "rb") as model_file: |
| 109 | net_def = mace_pb2.NetDef() |
| 110 | net_def.ParseFromString(model_file.read()) |
| 111 | with open(params_file_path, "rb") as params_file: |
| 112 | weights = bytearray(params_file.read()) |
| 113 | micro_conf = \ |
| 114 | config_parser.normalize_model_config(sub_model_conf) |
| 115 | MicroConverter(micro_conf, net_def, |
| 116 | weights, model_name).gen_code() |
| 117 | build_engine(model_name, micro_conf[ModelKeys.data_type]) |
| 118 | for graph_name, graph_config in micro_conf[ModelKeys.subgraphs].items(): # noqa |
| 119 | run_model_with_conf(flags, args, model_name, graph_config) |
| 120 | |
| 121 | |
| 122 | def run_model_with_conf(flags, args, model_name, model_conf): |
no test coverage detected