Samsung / ONE

On-device Neural Engine
Other
412 stars 144 forks source link

[onert] NYI CPU backend kernel - int8 quantization #4664

Open hseok-oh opened 3 years ago

hseok-oh commented 3 years ago

Prerequest

NYI cpu backend kernel: int8 quantization type

glistening commented 3 years ago

@hseok-oh As you already know, some operators need to be implemented in priority because they are used in one of our target model.

Note that Conv2D and DepthwiseConv2D use channel-wise quantization.

Also we need to take a look

because it got segmentation fault during running QUANTIZE only nnpackage.

$ LD_LIBRARY_PATH=lib Product/out/bin/nnpackage_run --nnpackage quantize 
Package Filename quantize
Segmentation fault

(ADDED) I will take a look QUANTIZE, then get started with MUL and SUB.

(ADDED) I've found there is problem selecting quantize from our target model by select_operator.py. I've tried to fix it, however, it is another problem. I will make another issue with current investigation. I've continued with workaround (#5353). Now, it shows:

$ LD_LIBRARY_PATH=lib Product/out/bin/nnpackage_run --nnpackage quantize
Package Filename quantize
Error during model loading : OperationValidator failed at line 288

Quantize does not handle INT8 input.

I will start to enable INT8 input type for Quantize since Quantize is the first operator of our target model.

glistening commented 3 years ago

I've created a PR #5446 for Quantize. Today, I started MUL ­— the next operator. I will do SUB and ADD together.

hseok-oh commented 3 years ago

I'll start SOFTMAX and RESIZE_BILINEAR.

glistening commented 3 years ago

I'll start Conv2D. It requires handling of channel-wise quantization params. (loader, IR, ...).

hseok-oh commented 3 years ago

I'll start PAD.

hseok-oh commented 3 years ago

@glistening I'll start AVERAGE_POOL_2D