# US 2021/0334007 A1 · Data pre-processing method and device, and related computer 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 2021/0334007 A1
- Document ID: US20210334007A1
- Status: Published application
- Kind: A1
- Application number: 16/622,503
- Filed: 2019-06-27
- Published: 2021-10-28
- Earliest claimed: 2018-08-28
- Assignees: Cambricon Technologies Corporation Limited
- Applicants: Cambricon Technologies Corporation Limited
- Inventors: Shaoli Liu; Xiaofu MENG
- Web page: https://patentgrep.com/patent/US20210334007A1

## CPC

- G06F 3/0611: {in relation to response time}
- G06F 12/0804: with main memory updating (G06F12/0806 takes precedence)
- G06F 3/0619: {in relation to data integrity, e.g. data losses, bit errors}
- G06F 3/0631: {by allocating resources to storage systems}
- G06F 3/0683: {Plurality of storage devices}
- G06F 12/0888: using selective caching, e.g. bypass
- G06F 13/1668: {Details of memory controller}
- G06N 3/02: Neural networks
- G06N 3/045: Combinations of networks
- G06N 3/0464: Convolutional networks [CNN, ConvNet]
- G06N 3/063: using electronic means
- G06F 12/0802: Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
- G06F 12/0811: with multilevel cache hierarchies
- G06F 2212/1016: Performance improvement
- G06F 2212/1044: Space efficiency improvement
- G06F 2212/454: Vector or matrix data
- G06F 2212/604: Details relating to cache allocation
- G06F 2213/16: Memory access
- G06N 3/08: Learning methods
- G06N 20/10: using kernel methods, e.g. support vector machines [SVM]
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS

## Abstract

The present disclosure provides a data pre-processing method and device and related computer device and storage medium. By storing the target output data corresponding to the target operation into the first memory close to the processor and reducing the time of reading the target output data, the occupation time of I/O read operations during the operation process can be reduced, and the speed and efficiency of the processor can be improved.

## Claims

### Claim 1

A data pre-processing method, comprising:
obtaining an available storage capacity of a first memory, a second memory, and a target operation, wherein the first memory is configured with an access speed faster than the second memory, wherein the access speed measures how fast a read or write operation is when executed on the first memory;
determining, according to the target operation and the available storage capacity of the first memory, target input data corresponding to the target operation;
determining, according to the target operation and the target input data, target output data of the target operation; and
storing, if the target output data of the target operation is the input data of another operation after the target operation, the target output data of the target operation into the first memory.

### Claim 2 (depends on 1)

The data pre-processing method of claim 1, further comprising:
storing, if the target output data of the target operation is the input data of another operation after the target operation, the target output data of the target operation into the first memory and the second memory;
wherein a storage capacity of the first memory is smaller than a storage capacity of the second memory.

### Claim 3 (depends on 1)

The data pre-processing method of claim 1, wherein the target operation includes one or more operations, and each operation corresponds to sub-target input data; and the determining of the target input data corresponding to the target operation according to the available storage capacity of the first memory and the target operation includes:
determining a count of operations that can be fused and obtaining a threshold of a count of fusion according to the available storage capacity of the first memory and a fusion attribute of each operation to be processed;
combining a selected number of the operations that can be fused to form the target operation, wherein the selected number is less than or equal to the threshold of the count of fusion; and
setting the sub-target input data corresponding to the selected number of operations that can be fused as the target input data corresponding to the target operation.

### Claim 4 (depends on 3)

The data pre-processing method of claim 3, wherein the operation to be processed is a neural network operation containing a plurality of operation layers, wherein each of the operation layers represents an operation; and the pre-processing method of data further includes the following step:
determining, according to a connection relationship of each operation layer of the neural network operation, the fusion attribute of each operation.

### Claim 5 (depends on 3)

The data pre-processing method of claim 3, further comprising:
storing, if an intermediate computation result output by a current operation in the target operation is required as the input data of another operation in the target operation, or an intermediate computation result output by a current operation is required as the input data of another operation, the intermediate computation result output by the current operation into the first memory, or the intermediate computation result output by the current operation into the first memory and the second memory.

### Claim 6 (depends on 1)

The data pre-processing method of claim 1, wherein the input data corresponding to the target operation includes a plurality of input data blocks, each target input data includes one or more of the input data blocks, and the count of the target input data corresponding to the target operation is one or more.

### Claim 7 (depends on 6)

The data pre-processing method of claim 6, wherein the target operation includes one or more sub-target operations, and each sub-target operation corresponds to one of the target input data; and the data pre-processing method further includes:
determining, according to a data volume of the target input data and a data volume of the target output data of each sub-target operation respectively, a target storage capacity required for each sub-target operation;
determining, according to the available storage capacity of the first memory and the target storage capacity required for the current sub-target operation, a remaining storage capacity of the first memory; and
determining, according to the remaining storage capacity of the first memory and the target storage capacity required for other sub-target operations other than the current sub-target operation, the count of the sub-target operations.

### Claim 8 (depends on 7)

The data pre-processing method of claim 7, further comprising
storing, if there is an intersection between the target input data of one or more of the sub-target operations, the intersection between the target input data of one or more of the sub-target operations into the first memory.

### Claim 9 (depends on 1)

The data pre-processing method of claim 1, further comprising:
storing, if an operation interval between other operation after the target operation and the target operation is within a preset range, the target output data into the first memory.

### Claim 10 (depends on 1)

The data pre-processing method of claim 1, further comprising:
determining, according to the data volume of the target input data of the target operation, a storage address of the target input data in the first memory; and
determining, according to the data volume of the target output data of the target operation, a storage address of the target output data in the first memory.

### Claim 11 (depends on 10)

The data pre-processing method of claim 10, further comprising:
allocating a part or all of the storage address of the target input data corresponding to the target operation to the target output data of the target operation when all the target operation are completed, if the other operations after the target operation do not need to use the target input data of the target operation.

### Claim 12

A data pre-processing device, comprising:
a storage capacity obtaining module configured to obtain an available storage capacity of a first memory, a second memory and a target operation, wherein the first memory is configured with an access speed faster than the second memory, wherein the access speed measures how fast a read or write operation is when executed on the first memory;
an input determination module configured to determine target input data corresponding to the target operation according to the target operation and the available storage capacity of the first memory;
an output determination module configured to determine target output data corresponding to the target operation according to the target operation and the target input data; and
a storage allocation module configured to store the target output data of the target operation into the first memory when the target output data of the target operation is the input data of other operation after the target operation.

### Claim 13 (depends on 12)

The data pre-processing device of claim 12, wherein the target operation includes one or more operations, and each of the operations corresponds to each sub-target input data; and the output determination module further includes:
a fusion determination unit configured to determine a count of operations that can be fused and obtain a threshold of the count of fusion according to the available storage capacity of the first memory and a fusion attribute of each operation to be processed; and
an input determination unit configured to combine a selected number of operations that can be fused to form the target operation, wherein the selected number is less than or equal to the threshold of the count of fusion; and set the sub-target input data corresponding to the selected number of operations that can be fused as the target input data corresponding to the target operation.

### Claim 14 (depends on 13)

The data pre-processing device of claim 13, wherein the operation to be processed is a neural network operation containing a plurality of operation layers, where each operation layer represents an operation; and the fusion determination unit is further configured to determine the fusion attribute of each operation according to a connection relationship of each operation layer of the neural network operation.

### Claim 15 (depends on 13)

The data pre-processing device of claim 13, wherein the storage allocation module is further configured to, if an intermediate computation result output by a current operation in the target operations is required as the input data of another operation in the target operations, or an intermediate computation result output by a current operation is required as the input data of another operation, store the intermediate computation result output by the current operation into the first memory, or store the intermediate computation result output by the current operation into the first memory and the second memory.

### Claim 16 (depends on 12)

The data pre-processing device of claim 12, wherein the target operation includes one or more sub-target operations, and each of the sub-target operations corresponds to one of the target input data; wherein all the input data corresponding to the target operation includes a plurality of input data blocks, each of the target input data includes one or more of the input data blocks, and the count of the target input data corresponding to the target operation is one or more; and the input determination module is further configured to:
determine a target storage capacity required for each of the sub-target operations according to a data volume of the target input data and a data volume of the target output data of each sub-target operation respectively;
determine a remaining storage capacity of the first memory according to the available storage capacity of the first memory and the target storage capacity required for the current sub-target operation; and
determine the count of the sub-target operation according to the remaining storage capacity of the first memory and the target storage capacity required for other sub-target operations other than the current sub-target operation.

### Claim 17 (depends on 16)

The data pre-processing device of claim 16, wherein the storage allocation module is further configured to, if there is an intersection of the target input data of one or more of the sub-target operations, store the intersection between the target input data of one or more of the sub-target operations into the first memory.

### Claim 18 (depends on 12)

The data pre-processing device of claim 12, wherein the storage allocation module is further configured to:
determine a storage address of the target input data in the first memory according to the data volume of the target input data of the target operation;
determine a storage address of the target output data in the first memory according to the data volume of the target output data of the target operation; and
allocate a part or all of the storage address of the target input data corresponding to the target operation to the target output data of the target operation when all the target operations are completed, if the other operations after the target operation do not need to use the target input data of the target operation.

### Claim 19 (depends on 1)

A computer device comprising a first memory, a second memory, and a processor; the first memory and the second memory are capable of reading and writing data; and the first memory or the second memory is configured to store a computer program, wherein the steps of the pre-processing method of data of claim 1 are implemented when the processor executes the computer program.

### Claim 20 (depends on 1)

A computer readable storage medium storing the computer program, wherein the steps of the pre-processing method of data of claim 1 are implemented when the computer program is executed by the processor.
