(input_file, input_node, input_shape, input_ranges,
input_data_type)
| 284 | |
| 285 | |
| 286 | def generate_input_data(input_file, input_node, input_shape, input_ranges, |
| 287 | input_data_type): |
| 288 | np.random.seed() |
| 289 | print("The scope of generated data: ", input_ranges) |
| 290 | for i in range(len(input_node)): |
| 291 | data = np.random.random(input_shape[i]) * ( |
| 292 | input_ranges[i][1] - input_ranges[i][0]) + input_ranges[i][0] |
| 293 | input_file_name = util.formatted_file_name(input_file, input_node[i]) |
| 294 | MaceLogger.info('Generate input file: %s' % input_file_name) |
| 295 | if input_data_type[i] == mace_pb2.DT_FLOAT: |
| 296 | np_data_type = np.float32 |
| 297 | elif input_data_type[i] == mace_pb2.DT_INT32: |
| 298 | np_data_type = np.int32 |
| 299 | |
| 300 | data.astype(np_data_type).tofile(input_file_name) |
| 301 | |
| 302 | |
| 303 | def parse_args(): |
no test coverage detected