(tflite_model_binary)
| 433 | continue |
| 434 | |
| 435 | def build_tflite_inputs(tflite_model_binary): |
| 436 | # Build input values and output values of the given tflite model. |
| 437 | interpreter = tf.lite.Interpreter(model_content=tflite_model_binary) |
| 438 | interpreter.allocate_tensors() |
| 439 | |
| 440 | input_details = interpreter.get_input_details() |
| 441 | input_values = [] |
| 442 | for input_detail in input_details: |
| 443 | # TODO(yunluli): Set proper min max value according to dtype. |
| 444 | input_value = create_tensor_data( |
| 445 | input_detail["dtype"], |
| 446 | input_detail["shape"], |
| 447 | min_value=0, |
| 448 | max_value=255) |
| 449 | interpreter.set_tensor(input_detail["index"], input_value) |
| 450 | input_values.append(input_value) |
| 451 | |
| 452 | interpreter.invoke() |
| 453 | |
| 454 | output_details = interpreter.get_output_details() |
| 455 | output_values = [] |
| 456 | for output_detail in output_details: |
| 457 | output_values.append(interpreter.get_tensor(output_detail["index"])) |
| 458 | |
| 459 | return input_values, output_values |
| 460 | |
| 461 | def build_example(label, param_dict_real): |
| 462 | """Build the model with parameter values set in param_dict_real. |
no test coverage detected