In this section, we will present how to generate an N2D2 export with the Python API. Exports are standalone code which are generated by N2D2.
If you want more specific information about an export please refer to it in the export section.
With the Python API, you can only export an
Once you have trained your model, you can convert your
n2d2.cells.Sequence into a
with the method
If you have used another way to train your model such as the interoperability with Keras or PyTorch, you can retrieve the
n2d2.cells.DeepNetCell with the appropriate
interoperability, you do not associate a
n2d2.provider.DataProvider to the
So if you want to calibrate your network, you need ot specify a data provider otherwise N2D2 will fail to generate the export.
Listing available cells for an export¶
If you want to get the list available cells for an export you can use the function
Frequently asked question¶
Scaling and ElemWise are the only layers supported in Fixed-point scaling mode¶
If you try to export an untrained model to C in int8, you may come across this error :
RuntimeError: Scaling and ElemWise are the only layers supported in Fixed-point scaling mode.
This is due to the weights parameter being initialized with high value. If you look at the log you may see warning lines like this :
Scaling (8.78614) > 1 for layer "model/dense/MatMul:0" is not supported with Single/Double-shift scaling. Falling back to Fixed-point scaling for this layer.
Training the model before exporting it will probably solve this issue.
Export CPP TensorRT¶