Atman-Kar / bunny

Tool to Binarize Neural Network Models (BuNNy)
0 stars 1 forks source link

RuntimeError: "batch_norm" not implemented for 'Char'; error while trying to pass int8 input for model eval #3

Open Atman-Kar opened 2 years ago

Atman-Kar commented 2 years ago

Find a way to allow batch_norm layer to accept int8 type input.

Few options we have:

hades-rp2010 commented 2 years ago

The conversion sounds like the easiest fix.
We convert the inputs to the batchnorm layers to a float, reconvert them back to int8 post batch norm.
Tho I am not aware of what this means in terms of training or correctness.

Atman-Kar commented 2 years ago

If we go through the conversion route, we would have to make custom layer called BunnyBatchNorm2D which:

Should we do it this way?

Note: A similar error occurs with MaxPool2D. However, Conv2D and Linear layers work perfectly with int8 input types.