0

In tensorRT > 10.8, there is a new feature to add the debug tensor while network is executing. https://docs.nvidia.com/deeplearning/tensorrt/10.8.0/inference-library/advanced.html#debug-tensors

I followed the link above to add required API into my code but there is nothing related debug tensor is printed out. Can I get help with this?

Below is the steps how I changed my code:

  1. Add mark_debug to the layer's output that I want to treat it as a debug tensor, for example
    shuffle_layer.get_output(0).name = "debug_tensor_shuffle"
    network.mark_debug(shuffle_layer.get_output(0))
  1. Define a DebugListener class deriving from IDebugListener and implement the virtual function for processing the tensor.
    class DebugPrinter : public nvinfer1::IDebugListener {
    public:
     bool processDebugTensor(
            const void* addr,
            nvinfer1::TensorLocation location,
            nvinfer1::DataType type,
            const nvinfer1::Dims& shape,
            const char* name,
            cudaStream_t stream) noexcept override {
                std::cout << "[DEBUG] Tensor Name: " << name << std::endl;

            return true;
        }
   };

... 3. Attach the listener to IExecutionContext.

    static DebugPrinter debug_listener;
    context->setDebugListener(&debug_listener);

... I also have set DEBUG to build config.

    config.set_flag(trt.BuilderFlag.DEBUG)

where config is in type of IBuilderConfig

After running my code, the function processDebugTensor is not triggered so it didn't print any information about the debug tensor. Did I miss something? Thank you.

1 Answer 1

2

Solved.

Need to add

context->setAllTensorsDebugState(true);

after

static DebugPrinter debug_listener;
context->setDebugListener(&debug_listener);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.