MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _get_tf1_parser

Function _get_tf1_parser

tensorflow/lite/python/tflite_convert.py:289–464  ·  view source on GitHub ↗

Returns ArgumentParser for tflite_convert for TensorFlow 1.X.

()

Source from the content-addressed store, hash-verified

287
288
289def _get_tf1_parser():
290 """Returns ArgumentParser for tflite_convert for TensorFlow 1.X."""
291 parser = argparse.ArgumentParser(
292 description=("Command line tool to run TensorFlow Lite Converter."))
293
294 # Output file flag.
295 parser.add_argument(
296 "--output_file",
297 type=str,
298 help="Full filepath of the output file.",
299 required=True)
300
301 # Input file flags.
302 input_file_group = parser.add_mutually_exclusive_group(required=True)
303 input_file_group.add_argument(
304 "--graph_def_file",
305 type=str,
306 help="Full filepath of file containing frozen TensorFlow GraphDef.")
307 input_file_group.add_argument(
308 "--saved_model_dir",
309 type=str,
310 help="Full filepath of directory containing the SavedModel.")
311 input_file_group.add_argument(
312 "--keras_model_file",
313 type=str,
314 help="Full filepath of HDF5 file containing tf.Keras model.")
315
316 # Model format flags.
317 parser.add_argument(
318 "--output_format",
319 type=str.upper,
320 choices=["TFLITE", "GRAPHVIZ_DOT"],
321 help="Output file format.")
322 parser.add_argument(
323 "--inference_type",
324 type=str.upper,
325 choices=["FLOAT", "QUANTIZED_UINT8"],
326 help="Target data type of real-number arrays in the output file.")
327 parser.add_argument(
328 "--inference_input_type",
329 type=str.upper,
330 choices=["FLOAT", "QUANTIZED_UINT8"],
331 help=("Target data type of real-number input arrays. Allows for a "
332 "different type for input arrays in the case of quantization."))
333
334 # Input and output arrays flags.
335 parser.add_argument(
336 "--input_arrays",
337 type=str,
338 help="Names of the input arrays, comma-separated.")
339 parser.add_argument(
340 "--input_shapes",
341 type=str,
342 help="Shapes corresponding to --input_arrays, colon-separated.")
343 parser.add_argument(
344 "--output_arrays",
345 type=str,
346 help="Names of the output arrays, comma-separated.")

Callers 1

run_mainFunction · 0.85

Calls 4

add_argumentMethod · 0.80
get_optionsMethod · 0.80
formatMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected