Returns ArgumentParser for tflite_convert for TensorFlow 2.0.
()
| 465 | |
| 466 | |
| 467 | def _get_tf2_parser(): |
| 468 | """Returns ArgumentParser for tflite_convert for TensorFlow 2.0.""" |
| 469 | parser = argparse.ArgumentParser( |
| 470 | description=("Command line tool to run TensorFlow Lite Converter.")) |
| 471 | |
| 472 | # Output file flag. |
| 473 | parser.add_argument( |
| 474 | "--output_file", |
| 475 | type=str, |
| 476 | help="Full filepath of the output file.", |
| 477 | required=True) |
| 478 | |
| 479 | # Input file flags. |
| 480 | input_file_group = parser.add_mutually_exclusive_group(required=True) |
| 481 | input_file_group.add_argument( |
| 482 | "--saved_model_dir", |
| 483 | type=str, |
| 484 | help="Full path of the directory containing the SavedModel.") |
| 485 | input_file_group.add_argument( |
| 486 | "--keras_model_file", |
| 487 | type=str, |
| 488 | help="Full filepath of HDF5 file containing tf.Keras model.") |
| 489 | return parser |
| 490 | |
| 491 | |
| 492 | def run_main(_): |
no test coverage detected