Skip to content

Questions about the Reformat layer #2921

@ZhangGe6

Description

@ZhangGe6

Hello, I am using TensorRT on Nvidia A100, and using the fantastic trex to visualize the engine graph.

When I build the engine from resnet50, I get the plan graph with Reformat layers near both input and output ends (Fig. a). Because I only care about the output of the formal part of resnet50 (onnx model link), I remove the other nodes and rebuild the engine again. However, the Reformat layers disappear (Fig. b).

trt_reformat_issue

So I am very curious about:

  1. Why are the reformat layers inserted (in Fig. a)? I notice that the Reformat layer changes the tensor format from NCHW and NC/4HW4 for the following convolution layers. If the Reformat layers help accelerate inference, can you share some explanations/materials?

    • I have found the layout illustration in the Nvidia official doc, but still a little confused.
  2. Is there a method to keep the Reformat layer inserting behavior consistent (between Fig. a & Fig.b)? That is to say, if I want to insert Reformat layers for the engine in Fig. b (It's better if the inserted Reformat layers are the same as the ones in Fig. a), how should I do?

Thanks in advance!

Metadata

Metadata

Assignees

Labels

triagedIssue has been triaged by maintainers

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions