# Confused about .engine / plugin

**URL:** <https://forums.developer.nvidia.com/t/confused-about-engine-plugin/146911>\
**Category:** DeepStream SDK\
**Created:** [August 14, 2020, 9:45pm UTC](https://forums.developer.nvidia.com/t/confused-about-engine-plugin/146911 "2020-08-14T21:45:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kbass](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/kbass/32/26307_2.png) [@kbass](https://forums.developer.nvidia.com/u/kbass)\
**Post date:** [August 14, 2020, 9:45pm UTC](https://forums.developer.nvidia.com/t/confused-about-engine-plugin/146911/1 "2020-08-14T21:45:15Z")

</div>

I am confused about the following…

If I create a .engine / plan file programmatically using TensorRT, does that .engine file include everything needed to run? I asked because if there are custom layers that were used to create the .engine, is that all encapsulated in the serialized .engine file?

If I load the .engine in deepstream, does it need access to the same custom routines?

The whole custom-lib-path thing confuses me. If I only want to use a serialized .engine without building it as part of deepstream application, is that custom library needed?

---

<div class="post-metadata">

**Author:** ![ersheng](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/ersheng/32/15508_2.png) [@ersheng](https://forums.developer.nvidia.com/u/ersheng)\
**Post date:** [August 20, 2020, 10:32am UTC](https://forums.developer.nvidia.com/t/confused-about-engine-plugin/146911/3 "2020-08-20T10:32:15Z")

</div>

@kbass

Yes, customized layers are also encapsulated in the serialized in engine file.  
But **`nvinfer_plugin`** module of TensorRT should have corresponding plugin solutions of the customized layer so that TensorRT can handle the engine with customized layer embedded.  
The same custom layer will be used if DeepStream loads the same engine because DeepStream exactly use TensorRT C++ APIs to load the engine.

Here is the documentation talking about how to add a customized layer to engine using C++ APIs or python APIs:  
[https://docs.nvidia.com/deeplearning/tensorrt/developer-guide/index.html#extending](https://docs.nvidia.com/deeplearning/tensorrt/developer-guide/index.html#extending)

You can refer to TensorRT OSS repository here [https://github.com/NVIDIA/TensorRT/tree/master/plugin](https://github.com/NVIDIA/TensorRT/tree/master/plugin) for more examples of customized layer implementations of TensorRT.

---

<div class="post-metadata">

**Author:** ![TomNVIDIA](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/tomnvidia/32/14181_2.png) [@TomNVIDIA](https://forums.developer.nvidia.com/u/TomNVIDIA)\
**Post date:** [October 12, 2021, 4:16pm UTC](https://forums.developer.nvidia.com/t/confused-about-engine-plugin/146911/5 "2021-10-12T16:16:51Z")

</div>

Closed on October 12, 2021, 4:16pm UTC


