METHOD AND DEVICE FOR DETERMINING SATURATION RATIO-BASED QUANTIZATION RANGE FOR QUANTIZATION OF NEURAL NETWORK
A method and a device for determining a quantization range based on a saturation ratio for quantization of an artificial neural network are disclosed. According to one aspect of the present invention, there is provided a computer-implemented method and a device for determining a quantization range for tensors of an artificial neural network, comprising observing a saturation ratio at a current iteration from the tensors of the artificial neural network and the quantization range; and adjusting the quantization range so that the observed saturation ratio follows a predetermined target saturation ratio.
1 - 15 . (canceled)
16 . A computer-implemented method of determining a quantization range for tensors of an artificial neural network, the method comprising:
observing a saturation ratio at a current iteration from the tensors and a quantization range of the artificial neural network; and
adjusting the quantization range such that the observed saturation ratio follows a preset target saturation ratio.
17 . The method of claim 16 , wherein the observing of the saturation ratio comprises calculating the ratio of the number of tensors outside the quantization range to the number of tensors.
18 . The method of claim 16 , wherein the adjusting of the quantization range comprises:
calculating a current moving average based on the observed saturation ratio and a past moving average calculated from saturation ratios observed at previous iterations; and
adjusting the quantization range based on a difference between the current moving average and the target saturation ratio.
19 . The method of claim 18 , wherein the calculating of the current moving average comprises calculating the current moving average through a weighted sum of the past moving average and the observed saturation ratio.
20 . The method of claim 19 , further comprising adjusting a weight of the past moving average and a weight of the observed saturation ratio.
21 . The method of claim 18 , wherein the adjusting of the quantization range comprises:
calculating an amount of change in the quantization range based on the difference between the current moving average and the target saturation ratio; and
adjusting the quantization range according to the amount of change in the quantization range.
22 . The method of claim 16 , further comprising setting an initial value of the quantization range based on batch normalization parameters of the artificial neural network.
23 . The method of claim 16 , wherein the tensors are derived from either training data in a training stage of the artificial neural network or user data in an inference stage.
24 . A device comprising:
a memory; and
a processor configured to execute computer-executable procedures stored in the memory,
wherein the computer-executable procedures comprise:
an observer configured to observe a saturation ratio at a current iteration from tensors and a quantization range of an artificial neural network; and
a controller configured to adjust the quantization range such that the observed saturation ratio follows a preset target saturation ratio.
25 . A computer-readable recording medium recording a computer program for executing the method of claim 16 .
26 . A computer-implemented method comprising:
receiving information on a quantization range from the outside; and
quantizing tensors of an artificial neural network based on the information on the quantization range,
wherein the quantization range is adjusted such that a observed saturation ratio from the quantized tensors of the artificial neural network at a current iteration follows a preset target saturation ratio.
27 . The computer-implemented method of claim 26 , wherein the observed saturation ratio is the ratio of the number of tensors outside the quantization range to the number of quantized tensors.
28 . The computer-implemented method of claim 26 , wherein the quantization range is adjusted based on a difference between a current moving average and the target saturation ratio at the current iteration,
wherein the current moving average is calculated based on and the observed saturation ratio and a past moving average calculated from saturation ratios observed at previous iterations.
29 . A processing device comprising:
a memory in which at least one instruction is stored; and
at least one processor,
wherein the at least one processor is configured to, by executing the at least one instruction:
receive information on a quantization range from the outside; and
quantize tensors of an artificial neural network based on the information on the quantization range,
wherein the quantization range is adjusted such that a observed saturation ratio from the quantized tensors of the artificial neural network at a current iteration follows a preset target saturation ratio.
30 . An arithmetic operation device comprising:
a range determination unit configured to observe a saturation ratio at a current iteration based on quantized tensors of an artificial neural network and to determine a quantization range such that the observed saturation ratio follows a preset target saturation ratio; and
a quantization unit configured to quantize the tensors of the artificial neural network based on the quantization range.