Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Memory allocation method and device of neural network

A neural network and memory allocation technology, applied in the field of deep learning, can solve problems such as large memory and unreasonable memory allocation, and achieve the effect of reducing memory footprint and optimizing memory allocation

Active Publication Date: 2019-12-20
HUAWEI TECH CO LTD
View PDF7 Cites 21 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

However, if both the requested 10M memory block and the requested 50M memory block can reuse the allocated 100M memory block, the requested 10M memory block will reuse the allocated 100M memory block, and a 50M memory block will be allocated to the neural network. Blocks, the entire neural network needs to occupy a total of 150M memory blocks, resulting in a large amount of memory occupied by the entire neural network, and unreasonable memory allocation

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Memory allocation method and device of neural network
  • Memory allocation method and device of neural network
  • Memory allocation method and device of neural network

Examples

Experimental program
Comparison scheme
Effect test

example 1

[0048] Example 1: The terminal device runs the neural network and records the information of the memory block occupied by the input parameters of each node in the neural network and the memory block occupied by the output parameters of each node, as well as the intermediate parameters occupied by each node The information of the memory block determines the information of the N memory blocks according to the information of the memory block occupied by the input parameter of each node in the neural network, the information of the memory block occupied by the output parameter, and the information of the memory block occupied by the intermediate parameters.

[0049] In example 1, the terminal device can simultaneously record the information of the input parameters, output parameters, and the memory block occupied by the intermediate parameters, and generate the N memories in the above step S201 according to the information of the input parameters, output parameters and the memory block...

example 2

[0052] Example 2: The terminal device runs the neural network, records the information of the memory block occupied by the input parameters, output parameters, or intermediate parameters of each node in the neural network, according to the input parameters, output parameters or intermediate parameters of each node. The information of the occupied memory block determines the information of the N memory blocks.

[0053] In the second example, the terminal device can only record the information of the memory block occupied by the input parameters of each node, generate the information of the N memory blocks in step S201, and then use this application figure 2 The method provided only optimizes the memory occupied by the input parameters. Alternatively, the terminal device may also only record the information of the memory block occupied by the output parameter of each node, generate the information of the N memory blocks in the above step S201, and then use this application figure ...

example 3

[0054] Example 3: The terminal device runs the neural network, records any two of the input parameters, output parameters, and intermediate parameters of each node in the neural network, and the information of the occupied memory block, according to any two of each node Information about the memory blocks occupied by each parameter, and determine the information about the N memory blocks.

[0055] In Example 3, the terminal device may only record any two parameters among the input parameters, intermediate parameters, and output parameters of each node, and then optimize any two parameters above. For the entire neural network, the optimization effect of example three is worse than that of example one, and example two is optimized.

[0056] Step S202: The terminal device sorts the N memory blocks from large to small according to the sizes of the N memory blocks to obtain a sorted sequence of the N memory blocks.

[0057] In the embodiment of this application, after sorting the N memor...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention provides a memory allocation method and device for a neural network, and the neural network needs to occupy N memory blocks during operation, and the method comprises the following steps: determining the information of the N memory blocks; sorting the N memory blocks from large to small according to the sizes of the N memory blocks to obtain a sorting sequence of the N memory blocks;allocating a first memory block to the neural network for operation of a first node set in the neural network; judging whether the nth memory block can reuse the memory blocks in the allocated set ornot, wherein the allocated set comprises a memory block allocated to the neural network; and if the nth memory block can reuse the memory block in the allocated set, allocating the reusable memory block to the neural network for operation of an nth node set in the neural network, and updating the allocated set; and sequentially executing the judgment from n = 2 to n = N according to the sorting sequence. By adopting the method and the device provided by the invention, the memory allocation of the neural network can be optimized.

Description

Technical field [0001] This application relates to the field of deep learning technology, and in particular to a memory allocation method and device of a neural network. Background technique [0002] In the current field of computer deep learning, in order to achieve better algorithm accuracy, deep learning neural networks are becoming more and more complex, and hardware capabilities limit the development of neural networks in a deeper direction, and memory optimization must be carried out. In order to achieve memory optimization, the industry usually adopts the following memory allocation strategies: [0003] Run the entire neural network, and then allocate memory for the entire neural network in the order in which it runs. For example, the neural network needs to occupy 100M memory block, 10M memory block and 50M memory block in sequence during operation. Then in the prior art, when the neural network applies for a 100M memory block, a 100M memory block can be allocated to the ...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Applications(China)
IPC IPC(8): G06F9/50G06N3/063
CPCG06F9/5016G06N3/063G06F2212/1044G06F12/023G06F12/04G06F12/0207G06F2209/501
Inventor 黄莉华丁皓范翱翔
Owner HUAWEI TECH CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products