custom layer---GAP(global average pooling) with tensorflow in tensorrt 4.0

How can I implement a custom layer ? I’d appreciate it if you could help me

Hi,

You can check this sample for how to add an uff-based plugin:
/usr/src/tensorrt/samples/sampleUffSSD/

In general, you can find the detail implementation of GPA on the TensorFlow GitHub:
https://github.com/tensorflow/tensorflow

Thanks.

Hi,

  1. Here are some details of my model:

1> I have a VGG model implemented by tensorflow, in which the whole connection layer is replaced by the global_max_pooling2d_1/Max layer.
I need to use tensorrt version 4.0.x to accelerate my VGG model in TX2, and some error was reported during the operation:

ERROR: UFFParser: Parser error: global_max_pooling2d_1/Max: Reduce operator not supported
Failure to parsing UFF file
Failure while parsing UFF file
ERROR: Network must have at least one input and one output
Segmentation fault (core dumped)

2> I have read the first example “sampleUffSSD” in your reply

3> I’ve converted a network with a custom layer into a UFF file.
And the highest version on TX2 is version4, so I can only use tensorrt version4 instead of version5

  1. My problem is that:

1> Can all custom layers be implemented using IpluginV2Ext and IpluginCreator in version4.0.x by TX2?

2> Can I implement my custom layer follow the steps by the following steps in official document?

https://docs.nvidia.com/deeplearning/sdk/tensorrt-developer-guide/index.html#extending → 4.1.2 → four steps in official document

I will very appreciate it .

Hi,

Is there any special reason to use TensorRT 4.0?

We have release a better plugin interface in TensorRT5.0.
It’s highly recommended to use v5.0 instead.

Thanks.

Hi,

Becuase we’re going to use TX2. The highest version of this is TensorRT4.0.

Can I use version5.0 on TX2?

Sure, please use JetPack 4.2 to install the TensorRT5.0.
See https://developer.nvidia.com/embedded/jetpack

Thanks