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).

So I am very curious about:
-
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?
-
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!
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
Reformatlayers 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, theReformatlayers disappear (Fig. b).So I am very curious about:
Why are the reformat layers inserted (in Fig. a)? I notice that the
Reformatlayer changes the tensor format fromNCHWandNC/4HW4for the following convolution layers. If theReformatlayers help accelerate inference, can you share some explanations/materials?Is there a method to keep the
Reformatlayer inserting behavior consistent (between Fig. a & Fig.b)? That is to say, if I want to insertReformatlayers for the engine in Fig. b (It's better if the insertedReformatlayers are the same as the ones in Fig. a), how should I do?Thanks in advance!