Created
March 15, 2023 06:35
-
-
Save novasush/2a8418147348957db0f48a207fca1d22 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tensorflow.python.compiler.tensorrt import trt_convert as trt | |
# Instantiate the TF-TRT converter | |
# Here saved model directory is the path to the saved model | |
# You can customise precision mode to FP32 FP16 or INT8 | |
converter = trt.TrtGraphConverterV2( | |
input_saved_model_dir=SAVED_MODEL_DIR, | |
precision_mode=trt.TrtPrecisionMode.FP32 | |
) | |
# Convert the model into TRT compatible segments | |
trt_func = converter.convert() | |
converter.summary() | |
# save the model by specifying output dir path | |
converter.save(output_saved_model_dir=OUTPUT_SAVED_MODEL_DIR) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment