Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do get_binding_shape(binding), get_binding_dtype(binding) and binding_is_input(binding) have an equivalent in TensorRT 10.2? #3991

Open
AriannST opened this issue Jul 9, 2024 · 1 comment

Comments

@AriannST
Copy link

AriannST commented Jul 9, 2024

Hi everyone, i'm checking this code about which allocates all buffers required for an engine:

def allocate_buffers(engine):
    inputs = []
    outputs = []
    bindings = []
    stream = cuda.Stream()
for binding in engine:
    size = trt.volume(engine.get_binding_shape(binding)) * engine.max_batch_size
    dtype = trt.nptype(engine.get_binding_dtype(binding))
    # Allocate host and device buffers
    host_mem = cuda.pagelocked_empty(size, dtype)
    device_mem = cuda.mem_alloc(host_mem.nbytes)
    # Append the device buffer to device bindings.
    bindings.append(int(device_mem))
    # Append to the appropriate list.
    if engine.binding_is_input(binding):
        inputs.append(HostDeviceMem(host_mem, device_mem))
    else:
        outputs.append(HostDeviceMem(host_mem, device_mem))
return inputs, outputs, bindings, stream

My problem is that it works in an environment with TensorRT 8.X., and I'm trying to run it in TensorRT 10.2. where get_binding_shape(binding), get_binding_dtype(binding) and binding_is_input(binding) functions were eliminated. Does equivalents of these functions exist? Or in any case, Is there a way to use tensor functions to obtain the same outputs? Thanks for your attention. Btw the class is tensorrt.ICudaEngine

@lix19937
Copy link

lix19937 commented Jul 9, 2024

#3954 (comment) @AriannST

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants