CEA-LIST / N2D2

N2D2 is an open source CAD framework for Deep Neural Network simulation and full DNN-based applications building.
Other
146 stars 35 forks source link

Error: Quantization of cell 'softmax' of type 'Softmax' is not supported yet #58

Closed GasparQ closed 4 years ago

GasparQ commented 4 years ago

Problem

I open this issue to say that the Quantization système for the softmax layer doesn't work anymore for int target with -calib -1.

Reproduce

Execute the command n2d2 mnist24_16c4s2_24c5s2_150_10.ini -export C -nbbits 16 -calib -1

You'll have the following error :

Calibration data 11112/12000
Calibration data 11208/12000
Calibration data 11304/12000
Calibration data 11400/12000
Calibration data 11520/12000
Calibration data 11616/12000
Calibration data 11712/12000
Calibration data 11808/12000
Calibration data 11904/12000
Calibration data 11976/12000
Calibration (16 bits):
conv1: scalingFactor = 3.688   
conv2: scalingFactor = 11.29   
fc1: scalingFactor = 26.78   
fc2: scalingFactor = 110.8   
Time elapsed: 26.51 s
Error: Quantization of cell 'softmax' of type 'Softmax' is not supported yet.

Start of resolution

The error seems to be thrown from the file src/DeepNetQuantization.cpp at line 417 :

softmax_error

There are 3 modes represented here :

The exception is thrown if we don't have one of the following case.

In which mode the SoftmaxCell need to be ?

thibaut-cea commented 4 years ago

Hi,

Thank you very much for the report.

It's an error on our side that appeared with the refactorization of the quantization mechanism. The last commit (2734fa1d5e9c5725beb85a5d8c24c5f020442a6f) should fix the issue.