# US 2022/0277170 A1 · Method for optimizing deep learning operator, device and storage medium

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2022/0277170 A1
- Document ID: US20220277170A1
- Status: Published application
- Kind: A1
- Application number: 17/482,316
- Filed: 2021-09-22
- Published: 2022-09-01
- Earliest claimed: 2021-02-26
- Assignees: Beijing Xiaomi Pinecone Electronics Co., Ltd.
- Applicants: Beijing Xiaomi Pinecone Electronics Co., Ltd.
- Inventors: Bin LI
- Web page: https://patentgrep.com/patent/US20220277170A1

## CPC

- G06F 18/21: Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06N 3/063: using electronic means
- G06F 7/483: Computations with numbers represented by a non-linear combination of denominational numbers, e.g. rational numbers, logarithmic number system or floating-point numbers {(G06F7/4806, G06F7/4824, G06F7/49, G06F7/491, G06F7/544 take precedence)}
- G06F 12/0897: with two or more cache hierarchy levels (with multilevel cache hierarchies G06F12/0811)
- G06N 3/04: Architecture, e.g. interconnection topology
- G06N 3/0464: Convolutional networks [CNN, ConvNet]
- G06N 3/0495: Quantised networks; Sparse networks; Compressed networks
- G06T 1/60: Memory management
- G06V 10/82: using neural networks
- G06V 10/95: {structured as a network, e.g. client-server architectures}
- G06F 2212/302: In image processor or graphics adapter
- G06F 2212/454: Vector or matrix data
- G06F 2212/455: Image or video data
- Y02D 10/00: Energy efficient computing, e.g. low power processors, power management or thermal management
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06T: IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06V: IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- Y02D: CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE

## Abstract

A method for optimizing a deep learning operator, includes: calling a method of reading an image object to read target data from an L1 cache of an image processor to the processor in response to detecting the target data in the L1 cache, performing a secondary quantization operation on the target data in the processor to obtain an operation result and writing the operation result into a main memory of the image processor. The target data is fixed-point data obtained after performing a quantization operation on data to be quantized in advance and the data to be quantized is one of the following: float-point data of an initial network layer of the neural network model and fixed-point data outputted from a network layer previous to the current network layer.

## Claims

### Claim 1

A method for optimizing a deep learning operator, applicable in a processor, comprising:
calling a method of reading an image object to read target data from an L1 cache of an image processor to the processor in response to detecting the target data in the L1 cache, wherein the target data comprises data to be inputted into a current network layer of a neural network model and the target data is fixed-point data obtained after performing a quantization operation on data to be quantized in advance, and the data to be quantized is one of the following: float-point data of an initial network layer of the neural network model and fixed-point data outputted from a network layer previous to the current network layer;
performing a secondary quantization operation on the target data in the processor to obtain an operation result; and
writing the operation result into a main memory of the image processor.

### Claim 2 (depends on 1)

The method of claim 1, further comprising:
reading the target data from the main memory of the image processor to an L2 cache of the image processor in response to not detecting the target data in the L1 cache of the image processor; and
reading the target data from the L2 cache to the L1 cache of the image processor.

### Claim 3 (depends on 1)

The method of claim 1, wherein, a number of digits in the fixed-point data is a first preset number, wherein the first preset number is 8 or 16; the target data comprises a weight and an offset value of the current network layer, and output data outputted from the network layer previous to the current network layer;
wherein performing the secondary quantization operation on the target data in the processor to obtain the operation result comprises:
performing an operation on the output data based on the weight to obtain a first operation value and obtaining a cumulative result of the first operation value and the offset value, wherein a number of digits in the cumulative result is a second preset number, and the second preset number is 32; and
performing the secondary quantization operation on the cumulative result to obtain the operation result, wherein a number of digits in the operation result is the first preset number.

### Claim 4 (depends on 1)

The method of claim 1, wherein, writing the operation result into the main memory of the image processor comprises:
calling a method of writing the image object to write the operation result into the L2 cache of the image processor; and
writing the operation result from the L2 cache into the main memory of the image processor.

### Claim 5

An electronic device, comprising:
an image processor, a processor, and a memory configured to store instructions executable by the processor;
wherein, the processor is configured to:
call a method of reading an image object to read target data from an L1 cache of an image processor to the processor in response to detecting the target data in the L1 cache, wherein the target data includes data to be inputted into a current network layer of a neural network model and the target data is fixed-point data obtained after performing a quantization operation on data to be quantized in advance, and the data to be quantized is one of the following: float-point data of an initial network layer of the neural network model and fixed-point data outputted from a network layer previous to the current network layer;
perform a secondary quantization operation on the target data in the processor to obtain an operation result; and
write the operation result into a main memory of the image processor.

### Claim 6 (depends on 5)

The electronic device of claim 5, wherein, the processor is further configured to:
read the target data from the main memory of the image processor to an L2 cache of the image processor in response to not detecting the target data in the L1 cache of the image processor; and
read the target data from the L2 cache to the L1 cache of the image processor.

### Claim 7 (depends on 5)

The electronic device of claim 5, wherein, a number of digits in the fixed-point data is a first preset number, wherein the first preset number is 8 or 16; the target data comprises a weight and an offset value of the current network layer, and output data outputted from the network layer previous to the current network layer;
wherein the processor is configured to perform the secondary quantization operation on the target data in the processor to obtain the operation result by:
performing an operation on the output data based on the weight to obtain a first operation value and obtaining a cumulative result of the first operation value and the offset value, wherein a number of digits in the cumulative result is a second preset number, and the second preset number is 32; and
performing the secondary quantization operation on the cumulative result to obtain the operation result, wherein a number of digits in the operation result is the first preset number.

### Claim 8 (depends on 5)

The electronic device of claim 5, wherein, the processor is configured to write the operation result into the main memory of the image processor by:
calling a method of writing the image object to write the operation result into the L2 cache of the image processor; and
writing the operation result from the L2 cache into the main memory of the image processor.

### Claim 9

A non-transitory computer readable storage medium having computer programs stored thereon, wherein the computer programs are executed by a processor to perform:
calling a method of reading an image object to read target data from an L1 cache of an image processor to the processor in response to detecting the target data in the L1 cache, wherein the target data includes data to be inputted into a current network layer of a neural network model and the target data is fixed-point data obtained after performing a quantization operation on data to be quantized in advance, and the data to be quantized is one of the following: float-point data of an initial network layer of the neural network model and fixed-point data outputted from a network layer previous to the current network layer;
performing a secondary quantization operation on the target data in the processor to obtain an operation result; and
writing the operation result into a main memory of the image processor

### Claim 10 (depends on 9)

The storage medium of claim 9, wherein the computer programs are executed by a processor to further perform:
reading the target data from the main memory of the image processor to an L2 cache of the image processor in response to not detecting the target data in the L1 cache of the image processor; and
reading the target data from the L2 cache to the L1 cache of the image processor.

### Claim 11 (depends on 9)

The storage medium of claim 9, wherein, a number of digits in the fixed-point data is a first preset number, wherein the first preset number is 8 or 16; the target data comprises a weight and an offset value of the current network layer, and output data outputted from the network layer previous to the current network layer;
wherein performing the secondary quantization operation on the target data in the processor to obtain the operation result comprises:
performing an operation on the output data based on the weight to obtain a first operation value and obtaining a cumulative result of the first operation value and the offset value, wherein a number of digits in the cumulative result is a second preset number, and the second preset number is 32; and
performing the secondary quantization operation on the cumulative result to obtain the operation result, wherein a number of digits in the operation result is the first preset number.

### Claim 12 (depends on 9)

The storage medium of claim 9, wherein, writing the operation result into the main memory of the image processor comprises:
calling a method of writing the image object to write the operation result into the L2 cache of the image processor; and
writing the operation result from the L2 cache into the main memory of the image processor.
