NVIDIA / NVIDIA/TensorRT

How to get the dynamic binding dimension of an ITensor when creating an INetworkDefinition.

Open
#3,426 13 comments 0 reactions 1 assignee View on GitHub

@zerollzeng is already working on this.

Since Nov 8, 2023.

triaged
Dominant language
C++
Stars
13.4k
Forks
2.4k
Avg merge
5d 3h
Merged PRs (30d)
2

Description

Hi everyone,

I'm trying to construct from scratch a network customizing from Faster-RCNN architecture. The raw input image could have variant/dynamic shape, so after some preprocessing step (like resize + padding + normalize), the input network shape also has dynamic shape. So I will try to add input by using:

nvinfer1::ITensor* input = network->addInput("image", nvinfer1::DataType::kFLOAT, nvinfer1::Dims4(-1, 3, -1, -1));

But my problem is, in some next layer/blocks, I need to restore ROIs to the original image's coordinate (like Decoding bounding box step), and to do that, I need some parameter from preprocessing step like (scale = inputNetworkShape + paddingShape/ rawNetworkShape, ...) and this param is also dynamic. But in the building INetworkDefinition phase, I could not use IExecutionContext to run getBindingDimensions because the context hasn't actually existed yet.
So I wanna ask some advices, how could I solve this problem?

Thanks for reading my post. It's my pleasure to hear response from you guys.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.