(name, shape, input_file, tensor_range, input_data_type)
| 30 | |
| 31 | |
| 32 | def generate_data(name, shape, input_file, tensor_range, input_data_type): |
| 33 | np.random.seed() |
| 34 | data = np.random.random(shape) * (tensor_range[1] - tensor_range[0]) \ |
| 35 | + tensor_range[0] |
| 36 | input_file_name = common.formatted_file_name(input_file, name) |
| 37 | six.print_('Generate input file: ', input_file_name) |
| 38 | if input_data_type == 'float32' or input_data_type == 'float16' or \ |
| 39 | input_data_type == 'bfloat16': |
| 40 | np_data_type = np.float32 |
| 41 | elif input_data_type == 'int32': |
| 42 | np_data_type = np.int32 |
| 43 | elif input_data_type == 'int16': |
| 44 | np_data_type = np.int16 |
| 45 | elif input_data_type == 'uint8': |
| 46 | np_data_type = np.uint8 |
| 47 | data.astype(np_data_type).tofile(input_file_name) |
| 48 | |
| 49 | |
| 50 | def generate_input_data(input_file, input_node, input_shape, input_ranges, |
no outgoing calls
no test coverage detected