IP Library Granted Patent US 11,657,254
Granted Patent B2
US 11,657,254 · App. 15/673,774 · Granted May 23, 2023

Computation method and device used in a convolutional neural network

Inventors: Jie Pan (Beijing, CN); Xu Wang (Beijing, CN)
Assignee: GLENFLY TECH CO., LTD.
G06N3/045G06N3/063G06N3/08
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,657,254
App. No.
15/673,774
Granted
May 23, 2023
Kind
B2
Abstract

A computation method used in a convolutional neural network is provided. The method includes: receiving original data; determining a first optimal quantization step size according to a distribution of the original data; performing fixed-point processing to the original data according to the first optimal quantization step size to generate first data; inputting the first data to a first layer of the convolutional neural network to generate first output data; determining a second optimal quantization step size according to a distribution of the first output data; performing the fixed-point processing to the first output data according to the second optimal quantization step size to generate second data; and inputting the second data to a second layer of the convolutional neural network.

Claims (96)

1. A computation method implemented in a convolutional neural network of an electronic computing device, comprising:

receiving original data;

determining a first optimal quantization step size according to a distribution of the original data, wherein the step of determining the first optimal quantization step size comprises:

calculating a mean and a variance of the distribution of the original data; calculating a first quantization parameter according to the mean and variance of the distribution of the original data; and determining the first optimal quantization step size according to the first quantization parameter;

performing fixed-point processing to the original data according to the first optimal quantization step size to generate first data;

training the convolutional neural network using a training data set;

inputting the first data to a first layer of the convolutional neural network to generate first output data;

determining a second optimal quantization step size according to a distribution of the first output data, wherein the step of determining the second optimal quantization step size comprises:

calculating a mean and a variance of the distribution of the first output data; calculating a second quantization parameter according to the mean and variance of the distribution of the first output data; and determining the second optimal quantization step size according to the second quantization parameter;

performing the fixed-point processing to the first output data according to the second optimal quantization step size to generate second data; and

inputting the second data to a second layer of the convolutional neural network;

wherein before performing the fixed-point processing to the first output data according to the second optimal quantization step size, the first output data is output to a rectified linear (ReLU) layer;

wherein the ReLU layer is implemented by using a Signoid function or a Tanh function;

wherein the step of determining the first/second optimal quantization step size further comprises:

determining a fixed-point format of the data to be quantized according to the first/second optimal quantization step size, wherein the fixed-point format includes a number of bits for a sign part, a number of bits for an integer part and a number of bits for a fraction part;

wherein the number of bits for an integer part is m, the number of bits for a fraction part is n, wherein m and n are expressed as:

m =log 2 (( M− 1)×Δ/2),

n =−log 2 (Δ),

where M is a quantization level and Δ is the first/second optimal quantization step size.

2. The computation method used in the convolutional neural network as claimed in claim 1 , wherein the data format of the original data is a floating-point format and the data formats of the first data and the second data are a fixed-point format.

3. The computation method used in the convolutional neural network as claimed in claim 1 , wherein the first optimal quantization step size is different from the second optimal quantization step size.

4. The computation method used in the convolutional neural network as claimed in claim 1 , wherein the first layer and the second layer are convolutional layers of the convolutional neural network.

5. The computation method used in the convolutional neural network as claimed in claim 4 , wherein the first data input to the first layer of the convolutional neural network comprises first image data, and/or first bias data.

6. The computation method used in the convolutional neural network as claimed in claim 5 , wherein the weight data and the bias data are performed fixed-point processing by using a non-uniform quantization method.

7. The computation method used in the convolutional neural network as claimed in claim 1 , wherein the first optimal quantization step size and/or the second optimal quantization step size are determined offline.

8. The computation method used in the convolutional neural network as claimed in claim 1 , wherein the step of performing the fixed-point processing to the original data according to the first optimal quantization step size to generate the first data further comprises:

determining a first fixed-point format according to the first optimal quantization step size; and

performing the fixed-point processing to the original data according to the first fixed-point format to generate the first data.

9. The computation method used in the convolutional neural network as claimed in claim 1 , wherein the original data comprises original image data, original weight data and/or original bias data.

10. The computation method used in the convolutional neural network as claimed in claim 1 , wherein before determining the second optimal quantization step size according to the distribution of the first output data further comprises:

converting the data format of the first output data from a fixed-point format to a floating-point format.

11. A computation device implemented in a convolutional neural network of an electronic computing device, comprising:

one or more processors; and

one or more computer storage media for storing one or more computer-readable instructions, wherein the processor is configured to drive the computer storage media to execute the following tasks:

receiving original data;

determining a first optimal quantization step size according to a distribution of the original data, wherein the step of determining the first optimal quantization step size comprises:

calculating a mean and a variance of the distribution of the original data; calculating a first quantization parameter according to the mean and variance of the distribution of the original data; and determining the first optimal quantization step size according to the first quantization parameter;

performing fixed-point processing to the original data according to the first optimal quantization step size to generate first data;

training the convolutional neural network using a training data set;

inputting the first data to a first layer of the convolutional neural network to generate first output data;

determining a second optimal quantization step size according to a distribution of the first output data, wherein the step of determining the second optimal quantization step size comprises: calculating a mean and a variance of the distribution of the first output data; calculating a second quantization parameter according to the mean and variance of the distribution of the first output data; and determining the second optimal quantization step size according to the second quantization parameter;

performing the fixed-point processing to the first output data according to the second optimal quantization step size to generate second data; and

inputting the second data to a second layer of the convolutional neural network;

wherein before performing the fixed-point processing to the first output data according to the second optimal quantization step size, the first output data is output to a rectified linear (ReLU) layer;

wherein the ReLU layer is implemented by using a Signoid function or a Tanh function;

wherein determining the first/second optimal quantization step size further comprises:

determining a fixed-point format of the data to be quantized according to the first/second optimal quantization step size, wherein the fixed-point format includes a number of bits for a sign part, a number of bits for an integer part and a number of bits for a fraction part;

wherein the number of bits for an integer part is m, the number of bits for a fraction part is n, wherein m and n are expressed as:

m =log 2 (( M− 1)×Δ/2),

n =−log 2 (Δ),

where M is a quantization level and Δ is the first/second optimal quantization step size.

12. The computation device used in the convolutional neural network as claimed in claim 11 , wherein the data format of the original data is a floating-point format and the data formats of the first data and the second data are a fixed-point format.

13. The computation device used in the convolutional neural network as claimed in claim 11 , wherein the first optimal quantization step size is different from the second optimal quantization step size.

14. The computation device used in the convolutional neural network as claimed in claim 11 , wherein the first layer and the second layer are convolutional layers of the convolutional neural network.

15. The computation device used in the convolutional neural network as claimed in claim 14 , wherein the first data input to the first layer of the convolutional neural network comprises first image data and/or first bias data.

16. The computation device used in the convolutional neural network as claimed in claim 15 , wherein the weight data and the bias data are performed fixed-point processing by using a non-uniform quantization method.

17. The computation device used in the convolutional neural network as claimed in claim 11 , wherein before performing the fixed-point processing to the first output data according to the second optimal quantization step size, the first output data is output to a rectified linear (ReLU) layer and/or a pooling layer.

18. The computation device used in the convolutional neural network as claimed in claim 11 , wherein the first optimal quantization step size and/or the second optimal quantization step size are determined offline.

19. The computation device used in the convolutional neural network as claimed in claim 11 , wherein performing the fixed-point processing to the original data according to the first optimal quantization step size to generate the first data further comprises:

determining a first fixed-point format according to the first optimal quantization step size; and

performing the fixed-point processing to the original data according to the first fixed-point format to generate the first data.

20. A computation method implemented in a convolutional neural network of an electronic computing device, comprising:

receiving original data;

determining a first optimal quantization step size according to a distribution of the original data, wherein the step of determining the first optimal quantization step size comprises:

calculating a mean and a variance of the distribution of the original data; calculating a first quantization parameter according to the mean and variance of the distribution of the original data and an adjustment function; and iteratively determining the first optimal quantization step size according to the first quantization parameter and a quantization error function;

performing fixed-point processing to the original data according to the first optimal quantization step size to generate first data;

training the convolutional neural network using a training data set;

inputting the first data to a first layer of the convolutional neural network to generate first output data;

determining a second optimal quantization step size according to a distribution of the first output data, wherein the step of determining the second optimal quantization step size comprises:

calculating a mean and a variance of the distribution of the first output data; calculating a second quantization parameter according to the mean and variance of the distribution of the first output data and the adjustment function; and iteratively determining the second optimal quantization step size according to the second quantization parameter and the quantization error function;

performing the fixed-point processing to the first output data according to the second optimal quantization step size to generate second data; and

inputting the second data to a second layer of the convolutional neural network;

wherein the step of determining the first/second optimal quantization step size further comprises:

determining a fixed-point format of the data to be quantized according to the first/second optimal quantization step size, wherein the fixed-point format includes a number of bits for a sign part, a number of bits for an integer part and a number of bits for a fraction part;

wherein the number of bits for an integer part is m, the number of bits for a fraction part is n, wherein m and n are expressed as:

m =log 2 (( M− 1)×Δ/2),

n =−log 2 (Δ),

where M is a quantization level and Δ is the first/second optimal quantization step size.

21. A computation device implemented in a convolutional neural network of an electronic computing device, comprising:

one or more processors; and

one or more computer storage media for storing one or more computer-readable instructions, wherein the processor is configured to drive the computer storage media to execute the following tasks:

receiving original data;

determining a first optimal quantization step size according to a distribution of the original data, wherein the step of determining the first optimal quantization step size comprises:

calculating a mean and a variance of the distribution of the original data; calculating a first quantization parameter according to the mean and variance of the distribution of the original data and an adjustment function; and iteratively determining the first optimal quantization step size according to the first quantization parameter and a quantization error function;

performing fixed-point processing to the original data according to the first optimal quantization step size to generate first data;

training the convolutional neural network using a training data set;

inputting the first data to a first layer of the convolutional neural network to generate first output data;

determining a second optimal quantization step size according to a distribution of the first output data, wherein the step of determining the second optimal quantization step size comprises: calculating a mean and a variance of the distribution of the first output data; calculating a second quantization parameter according to the mean and variance of the distribution of the first output data and the adjustment function; and iteratively determining the second optimal quantization step size according to the second quantization parameter and the quantization error function;

performing the fixed-point processing to the first output data according to the second optimal quantization step size to generate second data; and

inputting the second data to a second layer of the convolutional neural network;

wherein determining the first/second optimal quantization step size further comprises:

determining a fixed-point format of the data to be quantized according to the first/second optimal quantization step size, wherein the fixed-point format includes a number of bits for a sign part, a number of bits for an integer part and a number of bits for a fraction part;

wherein the number of bits for an integer part is m, the number of bits for a fraction part is n, wherein m and n are expressed as:

m =log 2 (( M− 1)×Δ/2),

n =−log 2 (Δ),

where M is a quantization level and Δ is the first/second optimal quantization step size.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Nov 18, 2021
From: SHANGHAI ZHAOXIN SEMICONDUCTOR CO., LTD.
To: GLENFLY TECH CO., LTD.
Reel/Frame 058965/0042 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Aug 10, 2017
From: PAN, JIE; WANG, XU
To: VIA ALLIANCE SEMICONDUCTOR CO., LTD.
Reel/Frame 043259/0460 →
Priority Claims (1)
CN 201710417495.1 · Jun 6, 2017 · national
Continuity (1)
Related Publication 20180349758A1 · Dec 6, 2018