tlt.models.text_classification.tf_text_classification_model.TFTextClassificationModel.optimize_graph¶
- TFTextClassificationModel.optimize_graph(output_dir, overwrite_model=False)¶
Performs FP32 graph optimization using the Intel Neural Compressor on the model and writes the inference-optimized model to the output_dir. Graph optimization includes converting variables to constants, removing training-only operations like checkpoint saving, stripping out parts of the graph that are never reached, removing debug operations like CheckNumerics, folding batch normalization ops into the pre-calculated weights, and fusing common operations into unified versions.
- Parameters
output_dir (str) – Writable output directory to save the optimized model
overwrite_model (bool) – Specify whether or not to overwrite the output_dir, if it already exists (default: False)
- Returns
None
- Raises
FileExistsError – if the output_dir already has a saved_model.pb file