Skip to content

'pytrt.Trt' object has no attribute 'AddDynamicShapeProfile' #72

@mahesh11T

Description

@mahesh11T

can I get help on how to run with dynamic shape input in python? can you add an example in python?

import cv2
import tritonclient.grpc as grpc_client
import time
import sys
sys.path.append("/opt/nvocdr/tiny-tensorrt/build/lib")
import pytrt
import numpy as np

#  /opt/nvocdr/tiny-tensorrt/build/lib/pytrt.cpython-310-x86_64-linux-gnu.so
# Assuming engine creation logic exists prior to this snippet
# Load the engine
engineFile = r"/opt/nvocdr/engines/ocdnet.fp16.engine"
onnx_model = r"/opt/nvocdr/onnx_model/ocdnet.onnx"

trt = pytrt.Trt()
# Create an optimization profile
min_shape = (1, 3, 736, 1280)  # Define minimum input shape
max_shape = (4, 3, 736, 1280)  # Define maximum input shape
# opt_profile = trt.create_optimization_profile()
trt.AddDynamicShapeProfile('INPUT_DATA', min_shape, max_shape)
trt.AddDynamicShapeProfile('INPUT_IMG_EXTENSION', min_shape, max_shape)

trt.BuildEngine(onnx_model, engineFile)

image

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions