Operation method, device, terminal and storage medium of neural network

By dividing and using appropriate memory to access data at different operating stages of the neural network model, the problem of excessive power consumption in the operation of the neural network is solved, and the efficient and stable operation of the system is achieved.

CN114692852BActive Publication Date: 2025-07-29GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202011627461.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-31
Publication Date
2025-07-29
Estimated Expiration
2041-01-28

AI Technical Summary

Technical Problem

In the prior art, the system power consumption may be too high due to the use of DRAM during operation of neural networks, which may cause the system to overheat or not meet the normal operation needs of the processor.

Method used

By estimating the power consumption of the neural network model in different network operation stages, it is divided into high-power and low-power stages. Low-power memory is used to access data in the high-power stage, and high-power memory is used to access data in the low-power stage to reduce data access power consumption.

Benefits of technology

Effectively reduce the operating power consumption of the neural network model, avoid abnormal heating of the system, and ensure that the processor is working saturated while improving the system's operating performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114692852B_ABST
    Figure CN114692852B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a method, apparatus, terminal, and storage medium for running a neural network, belonging to the technical field of terminals. The method includes: obtaining an estimated operating power consumption corresponding to different network operating stages of a neural network model; dividing the network operating stages corresponding to the neural network model into a first type of operating stage and a second type of operating stage based on the estimated operating power consumption and a power consumption threshold; when the neural network model runs to the first type of operating stage, accessing neural network data using a first memory; when the neural network model runs to the second type of operating stage, accessing neural network data using a second memory, and the data access power consumption of the first memory is lower than that of the second memory. While ensuring that the processor operates saturated when running the neural network model, it avoids an increase in system power consumption caused by high-speed access to neural network data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of terminal technology, and in particular to a method, device, terminal, and storage medium for operating a neural network. Background Art

[0002] With the development of neural network technology, the application scenarios of neural networks are becoming more and more extensive, such as image processing, audio and video processing, etc.

[0003] In related technologies, when a processor runs a neural network, dynamic random access memory (DRAM) typically provides storage for input and output data. To meet the processor's requirements for high-speed reading of input data and high-speed delivery of output data, increasing the transmission bandwidth between the processor and DRAM or increasing the DRAM's data throughput frequency is often employed to ensure high processing speed when the processor runs the neural network.

[0004] Obviously, adopting the operation mode of the neural network in the relevant technology will increase the system operation power consumption, which may cause the system power consumption to exceed the power consumption upper limit, thereby affecting the terminal's operation performance. Summary of the Invention

[0005] The embodiments of the present application provide a method, device, terminal, and storage medium for operating a neural network. The technical solution is as follows:

[0006] According to one aspect of the present application, a method for operating a neural network is provided, the method comprising:

[0007] Obtaining estimated operating power consumption corresponding to different network operation stages of the neural network model, wherein the network operation stage refers to the completion progress of the inference process of the neural network model;

[0008] Based on the estimated operating power consumption and the power consumption threshold, dividing the network operating stage corresponding to the neural network model into a first operating stage and a second operating stage, the estimated operating power consumption corresponding to the first operating stage being higher than the power consumption threshold, and the estimated operating power consumption corresponding to the second operating stage being lower than the power consumption threshold;

[0009] In response to the neural network model running to the first type of running stage, using a first memory to access neural network data; and

[0010] In response to the neural network model running to the second type of running stage, the second memory is used to access the neural network data, and the data access power consumption of the first memory is lower than the data access power consumption of the second memory.

[0011] According to another aspect of the present application, there is provided an operating device for a neural network, the device comprising:

[0012] An acquisition module, configured to acquire the estimated operating power consumption corresponding to different network operating stages of the neural network, where the network operating stage refers to the completion progress of the inference process of the neural network model;

[0013] A division module, configured to divide the network operating stages corresponding to the neural network model into a first type of operating stage and a second type of operating stage based on the estimated operating power consumption and a power consumption threshold, where the estimated operating power consumption corresponding to the first type of operating stage is higher than the power consumption threshold, and the estimated operating power consumption corresponding to the second type of operating stage is lower than the power consumption threshold;

[0014] A first access module, configured to, in response to the neural network model running to the first type of operating stage, access neural network data using a first memory; and

[0015] A second access module, configured to, in response to the neural network model running to the second type of operating stage, access the neural network data using a second memory, where the data access power consumption of the first memory is lower than that of the second memory.

[0016] According to another aspect of the present application, there is provided a terminal, the terminal comprising:

[0017] A processor;

[0018] A memory, where program instructions are stored on the memory, and when the processor executes the program instructions, the operating method of the neural network described in the previous aspect is implemented.

[0019] According to another aspect of the present application, there is provided a computer-readable storage medium, where program instructions are stored in the computer-readable storage medium, and when the program instructions are executed by a processor, the operating method of the neural network described in the previous aspect is implemented.

[0020] According to one aspect of the present application, there is provided a computer program product, the computer program product comprising computer instructions, where the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the operating method of the neural network described in the previous aspect.

[0021] The beneficial effects brought by the technical solutions provided in the embodiments of the present application may include:

[0022] Based on the structural characteristics of the neural network, by pre-acquiring the estimated operating power consumption corresponding to different network operation stages when running the neural network model, so that in the actual operation of the neural network model, the data storage location of the neural network data required by the neural network model during the operation process can be determined according to the relationship between the estimated operating power consumption and the preset power consumption threshold. For example, when the operating power consumption is high, the neural network data can be accessed by using a memory with low data access power consumption, and the operating power consumption of the neural network model can be reduced by reducing the data access power consumption of the neural network data, thereby ensuring that the processor works at saturation when running the neural network model, while avoiding high-speed access to neural network data that leads to increased system power consumption, thereby reducing the probability of abnormal system heating, and thus ensuring the system's operating performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly introduce the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0024] Figure 1 A flowchart of a method for operating a neural network provided by an exemplary embodiment of the present application is shown;

[0025] Figure 2 A flowchart showing a method for operating a neural network provided by another exemplary embodiment of the present application is shown;

[0026] Figure 3 A schematic diagram of caching neural network data during operation of a neural network is shown in an exemplary embodiment of the present application;

[0027] Figure 4 A schematic diagram of the process of estimating the operating power consumption corresponding to the simulated computing neural network model is shown;

[0028] Figure 5 A schematic diagram of a process of accessing neural network data through system cache and DRAM is shown in an exemplary embodiment of the present application;

[0029] Figure 6 A schematic diagram of a process of accessing neural network data through a system buffer memory is shown in an exemplary embodiment of the present application;

[0030] Figure 7 A schematic diagram showing the division of data cache locations corresponding to different neural network data shown in an exemplary embodiment of the present application is shown;

[0031] Figure 8Shows a schematic diagram of the difference between a data access solution for all DRAMs and a data access solution for DRAMs combined with a System Cache / Buffer;

[0032] Figure 9 Shows a flowchart of a method for running a neural network provided by another exemplary embodiment of the present application;

[0033] Figure 10 Shows a flowchart of a method for running a neural network provided by another exemplary embodiment of the present application;

[0034] Figure 11 Shows a block diagram of the structure of a device for running a neural network provided by an exemplary embodiment of the present application;

[0035] Figure 12 Shows a block diagram of the structure of a terminal provided by an exemplary embodiment of the present application. Detailed implementation manners

[0036] To make the objectives, technical solutions, and advantages of the present application clearer, the following will further describe the embodiments of the present application in detail with reference to the accompanying drawings.

[0037] When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0038] In the related art, during the process of a processor running a neural network model, DRAM is usually used as the data cache location for input and output data. Taking the process of a neural network processor (NPU) running a neural network as an example, there are usually various data access behaviors during the process of the NPU running a neural network. For example, a read operation on input data (i.e., the data to be processed in the neural network), and a write operation on output data (i.e., the result data obtained after the neural network processes the input data). In order to ensure that the NPU can maintain a high running efficiency during operation, usually, the input data is read at an extremely high speed at the beginning, and the result data is sent out of the NPU at an extremely high speed after the data processing is completed. Usually, in order to ensure that the data can enter and exit the NPU extremely quickly, methods such as widening the DRAM transmission bandwidth or increasing the DRAM frequency are adopted.

[0039] Obviously, in the solution of the related art, since there is an upper limit to the system power consumption that the system (or terminal) can withstand, on the one hand, if the operation requirements of the NPU are met without considering the system power consumption, it will cause extremely high operation power consumption during the operation of the neural network by the NPU, which may lead to overheating of the system, thus affecting the normal operation of the system; on the other hand, if the maximum system power consumption that the system can withstand is considered, the normal operation requirements of the NPU cannot be met, and it may be necessary to reduce the rate of accessing data by the NPU, resulting in the NPU not being able to work saturatedly.

[0040] To solve the problems in the related art, the embodiment of the present application provides a new method for operating a neural network. Based on the structural characteristics of the neural network, by pre-obtaining the estimated operation power consumption corresponding to different network operation stages when running the neural network model, so that during the actual operation of the neural network model, according to the relationship between the estimated operation power consumption and the preset power consumption threshold, the data storage location of the neural network data required by the neural network model during operation can be determined. For example, when the operation power consumption is high, a memory with lower data access power consumption is used to access the neural network data, and the operation power consumption of the neural network model is reduced by reducing the data access power consumption of the neural network data, so as to ensure that the processor works saturatedly when running the neural network, while avoiding abnormal heating of the system caused by an increase in system power consumption due to high-speed access to neural network data, thereby ensuring the operation performance of the system.

[0041] It should be noted that the method for operating a neural network shown in the embodiment of the present application can be applied to a terminal with the operation function of the neural network. The terminal may include a mobile phone, a tablet computer, a laptop computer, a desktop computer, an all-in-one computer, a server, a workstation, a television, a set-top box, smart glasses, a smart watch, a digital camera, a Moving Picture Experts Group Audio Layer IV (MP4) player, a Moving Picture Experts Group Audio Layer V (MP5) player, a learning machine, a point reader, an e-book, an electronic dictionary, a vehicle-mounted terminal, a Virtual Reality (VR) player, or an Augmented Reality (AR) player, etc.

[0042] Figure 1 The flowchart of the method for operating a neural network provided by an exemplary embodiment of the present application is shown. The embodiment of the present application takes the application of this method to a terminal as an example for exemplary description. The method includes:

[0043] Step 101, obtaining the estimated operating power consumption corresponding to the neural network model at different network operating stages, where the network operating stage refers to the completion progress of the neural network model inference process.

[0044] The network operation stage refers to the completion progress of the neural network model inference process. The network operation stage of the neural network model can be expressed in percentage. For example, the completion progress of the neural network model inference process can be expressed in percentage. The completion progress of the neural network model ranges from 0% to 100%. When the network operation stage reaches 100%, it means that the inference process of the neural network model is completed. For another example, the completion progress of a neural network model can be expressed in time. The network operation stage of the neural network model ranges from 0th second to Tth second. When the network operation stage reaches Tth second, it means that the inference process of the neural network model is completed, where T is a positive integer.

[0045] In one possible implementation, the terminal locally stores estimated operating power consumption corresponding to different neural network models in different network operation stages. When the terminal needs to run the neural network model, the neural network model and its corresponding estimated operating power consumption can be obtained from the local memory of the terminal; or, the terminal can download the neural network model and its corresponding estimated operating power consumption from the server via a wired or wireless network; or, a power consumption model (Power Model) is provided in the terminal, and the estimated operating power consumption corresponding to the neural network model in different network operation stages is obtained by performing simulation operations on the neural network model before running the neural network model. The embodiment of the present application does not limit the method of obtaining the estimated operating power consumption corresponding to the neural network.

[0046] The network operation stage refers to the various operation stages of the processor running the neural network model from the beginning of processing data to the end of processing. The network operation stage can be divided according to percentages, for example, running to 10%.

[0047] Optionally, the processor running the neural network model can be a central processing unit (CPU), NPU, DSP, image processor (GPU), etc. The embodiment of the present application does not limit the operating environment of the neural network model.

[0048] Optionally, the estimated operating power consumption corresponding to the neural network model can be stored in the form of a power consumption curve. Correspondingly, the terminal can obtain the corresponding estimated operating power consumption at different operating nodes or operating stages from the power consumption curve.

[0049] Step 102: Based on the estimated operating power consumption and the power consumption threshold, divide the network operating phases corresponding to the neural network model into a first type of operating phase and a second type of operating phase. The estimated operating power consumption corresponding to the first type of operating phase is higher than the power consumption threshold, and the estimated operating power consumption corresponding to the second type of operating phase is lower than the power consumption threshold.

[0050] Among them, the power consumption threshold can be set by developers, which can refer to the power consumption threshold of the terminal, or the power consumption threshold corresponding to a certain system in the terminal; it can also refer to the power consumption threshold of the processor running the neural network model. The embodiments of the present application do not limit this.

[0051] Optionally, the power consumption threshold can be a fixed value or can be automatically adjusted according to the operating state of the terminal or the system. For example, when the current power consumption of the terminal is relatively large, the power consumption threshold can be appropriately reduced.

[0052] In a possible implementation manner, the terminal divides the network operating phases corresponding to the neural network model into a first type of operating phase and a second type of operating phase based on the relationship between the power consumption threshold and the estimated operating power consumption. For example, if the estimated operating power consumption corresponding to a certain operating moment is greater than the power consumption threshold, then this operating moment is classified into the first type of operating phase; if the estimated operating power consumption corresponding to a certain operating moment is less than the power consumption threshold, then this operating moment is classified into the second type of operating phase.

[0053] Step 103: When the neural network model runs to the first type of operating phase, use the first memory to access neural network data.

[0054] Different from the related art where neural network data is accessed through DRAM during the running of the neural network, in the embodiments of the present application, when dividing the operating phases of the neural network model into different types of operating phases according to the relationship between the power consumption threshold and the estimated operating power consumption, different data access locations are provided for the neural network data corresponding to different operating phases.

[0055] Since the first type of operating phase indicates that the estimated operating power consumption corresponding to the neural network model is relatively high, in order to reduce the operating power consumption when the neural network model runs to the first type of operating phase, therefore, in a possible implementation manner, a first memory that requires lower data access power consumption is used to access neural network data, and the operating power consumption corresponding to the neural network model is reduced by reducing the data access power consumption.

[0056] Optionally, the first memory includes at least one of a system cache (System Cache, Sys$) and a system buffer memory (System Buffer, SysBuf); the second memory includes DRAM. Exemplarily, the above Sys$ and SysBuf are composed of SRAM.

[0057] Step 104 , in response to the neural network model running to the second type of running stage, the second memory is used to access the neural network data, and the data access power consumption of the first memory is lower than the data access power consumption of the second memory.

[0058] Since the estimated operating power consumption corresponding to the second type of operating stage is lower than the power consumption threshold, that is, when the neural network model runs to the second type of operating stage, the corresponding operating power consumption is lower, in order not to occupy the first memory to access the neural network data, in one possible implementation, a second memory with higher data access power consumption is used to access the neural network data.

[0059] The data access power consumption of the first memory is lower than the data access power consumption of the second memory.

[0060] In an exemplary example, when the terminal runs a neural network model, Sys$ and / or SysBuf are used to access the neural network data in the first type of running stage, and DRAM is used to access the neural network data in the second type of running stage.

[0061] Optionally, the terminal can pre-store the division information of the first type of operating stage and the second type of operating stage corresponding to the neural network model. That is to say, when the terminal has the need to run the neural network model, it can directly obtain the first type of operating stage and the second type of operating stage corresponding to the neural network model. There is no need to divide the network operating stage of the neural network model according to the power consumption threshold and the estimated operating power consumption, which can improve the operating efficiency of the neural network model.

[0062] To sum up, based on the structural characteristics of the neural network, by pre-acquiring the estimated operating power consumption corresponding to different network operation stages when running the neural network model, so that in the actual operation of the neural network model, the data storage location of the neural network data required by the neural network model during the operation can be determined according to the relationship between the estimated operating power consumption and the preset power consumption threshold. For example, when the operating power consumption is high, the neural network data can be accessed by using a memory with low data access power consumption, and the operating power consumption of the neural network model can be reduced by reducing the data access power consumption of the neural network data, thereby ensuring that the processor works at saturation when running the neural network model, while avoiding high-speed access to the neural network data, which leads to increased system power consumption and abnormal heating of the system, thereby ensuring the system's operating performance.

[0063] Due to the special structure of the neural network model, in one possible implementation, the terminal can obtain the estimated operating power consumption corresponding to the neural network model in different network operation stages by performing simulation operations on the neural network model, thereby achieving the purpose of subsequently determining the neural network data access location based on the estimated operating power consumption.

[0064] Please refer to Figure 2 , which shows a flow chart of a method for operating a neural network provided by another exemplary embodiment of the present application. This embodiment of the present application takes the method applied to a terminal as an example for illustrative description, and the method includes:

[0065] Step 201 , performing simulation operation on the neural network model to obtain the estimated operating power consumption corresponding to the neural network model at different network operation stages during the simulation operation process.

[0066] In one possible implementation, the estimated operating power consumption corresponding to the neural network model is obtained by simulating the neural network model. Correspondingly, a component for estimating the operating power consumption is provided in the terminal, such as a power model (used to simulate and obtain the estimated operating power consumption corresponding to each neural network model). When the terminal needs to run the neural network model, the component can be used to simulate the neural network model, thereby obtaining the estimated operating power consumption corresponding to different network operation stages during the simulation operation process.

[0067] Optionally, due to the fixed nature of the neural network model structure, after the terminal estimates the estimated operating power consumption corresponding to the neural network model for the first time, the estimated operating power consumption can be associated with the neural network model and stored, so that when the neural network model is subsequently run, the estimated operating power consumption corresponding to the neural network model can be directly obtained without repeatedly simulating the neural network model, thereby reducing the terminal power consumption.

[0068] Since neural network data usually includes initial data (i.e., data input into the neural network for calculation), intermediate feature data, and result data (i.e., output data of the neural network), based on the type of neural network data contained in the neural network model, in the process of simulating the neural network model, its estimated operating power consumption corresponding to different network operation stages generally also corresponds to the estimated operating power consumption corresponding to accessing the above three types of data. Therefore, in one possible implementation, if it is necessary to obtain the total estimated operating power consumption corresponding to different network operation stages, it is necessary to perform superposition calculations on the above three types of data to obtain it.

[0069] In an exemplary embodiment, the process of estimating the estimated operating power consumption of a neural network model at different network operation stages may include the following steps:

[0070] 1. Perform simulation operations on the neural network model to obtain the first estimated operating power consumption corresponding to when the neural network model reads initial data at different network operation stages, the second estimated operating power consumption corresponding to when accessing intermediate feature data, and the third estimated operating power consumption corresponding to when writing result data.

[0071] Since there are input nodes for initial data and output nodes for result data during the operation of a neural network model; during the intermediate process of the operation of the neural network model, there are also intermediate access nodes for writing and reading intermediate feature data. Therefore, in a possible implementation, if it is necessary to estimate the corresponding estimated operating power consumption of the neural network model at different network operation stages, the first estimated operating power consumption corresponding to reading the initial data at different network operation stages, the second estimated operating power consumption corresponding to accessing the intermediate feature data, and the third estimated operating power consumption corresponding to writing the result data can be calculated respectively, so as to obtain the total estimated operating power consumption of the neural network model at different network operation stages by superimposing them.

[0072] In an exemplary example, such as Figure 3 shown, which shows a schematic diagram of the caching of neural network data during the operation of a neural network shown in an exemplary embodiment of the present application. When the NPU 311 runs a certain neural network, there are 4 pieces of neural network data entering and leaving the NPU 311, namely the input of one piece of initial data, the writing and reading of two intermediate feature images, and the output of one piece of result data. That is, there is an input node, two intermediate access nodes, and an output node on the above neural network. Therefore, an input cache 302 for the initial data, an intermediate access cache 303 for the intermediate feature image 1, an intermediate access cache 304 for the intermediate feature image 2, and an output cache 315 for the result data are required.

[0073] Second, superimpose the first estimated operating power consumption, the second estimated operating power consumption, and the third estimated operating power consumption according to the corresponding network operation stages to obtain the estimated operating power consumption of the neural network model at different network operation stages.

[0074] In a possible implementation, if the neural network data corresponding to the neural network model includes initial data, intermediate feature data, and result data, correspondingly, when estimating the overall estimated operating power consumption corresponding to the neural network model, it can be obtained by correspondingly superimposing the estimated operating power consumptions corresponding to the respective neural network data at different network operation stages, that is, superimposing the first estimated operating power consumption, the second estimated operating power consumption, and the third estimated operating power consumption according to the corresponding network operation stages, so as to obtain the estimated operating power consumption of the neural network model at different network operation stages.

[0075] In an exemplary example, such as Figure 4As shown, it shows a schematic process diagram of predicting the estimated operating power consumption corresponding to the analog operation neural network model. Taking the neural network data including initial data, intermediate feature image 1, intermediate feature image 2, and result data as an example, the operating power consumption required for data access on the above 4 data access nodes is predicted, and the estimated operating power consumption curve 21 of the first estimated operating power consumption corresponding to the initial data in different network operation stages, the estimated operating power consumption curve 22 of the second estimated operating power consumption corresponding to the intermediate feature image 1 in different network operation stages, the estimated operating power consumption curve 23 of the second estimated operating power consumption corresponding to the intermediate feature image 2 during the network operation, and the estimated operating power consumption curve 24 of the third estimated operating power consumption corresponding to the result data during the network operation are obtained. According to the corresponding relationship of the network operation stages, the estimated operating power consumption curves 21, estimated operating power consumption curve 22, estimated operating power consumption curve 23, and estimated operating power consumption curve 24 are superimposed, and the estimated operating power consumption curve 25 of the overall estimated operating power consumption corresponding to the neural network data in different network operation stages is obtained.

[0076] Optionally, when the neural network model runs on different processors, due to differences in the structure and performance of different processors. For example, when the same target neural network data runs on processor A, the intermediate feature data does not need to enter and exit processor A, and when it runs on processor B, the intermediate feature data needs to enter and exit processor B. Therefore, when performing analog operations on the target neural network data, it needs to be determined based on the specific operating environment of the neural network model. That is to say, for the case where the intermediate feature data does not need to enter and exit the processor, the access power consumption of the intermediate feature data does not need to be estimated. Only by superimposing the estimated operating power consumption corresponding to the initial data and the result data can the estimated operating power consumption corresponding to the neural network model be obtained.

[0077] Step 202, based on the estimated operating power consumption and the power consumption threshold, divide the network operation stages corresponding to the neural network model into a first type of operation stage and a second type of operation stage. The estimated operating power consumption corresponding to the first type of operation stage is higher than the power consumption threshold, and the estimated operating power consumption corresponding to the second type of operation stage is lower than the power consumption threshold.

[0078] When the terminal obtains the estimated operating power consumption curve corresponding to the neural network model, it also correspondingly obtains the estimated operating power consumption corresponding to the neural network model at different operation nodes. Thus, by comparing the relationship between the estimated operating power consumption and the power consumption threshold at different operation nodes, the operation nodes are divided into different types of operation stages.

[0079] In an exemplary example, if the neural network model includes N operating nodes, where N is an integer greater than 0, and if the estimated operating power consumptions corresponding to the operating nodes L1 to L20 are all greater than the power consumption threshold, then the operating nodes L1 to L20 are classified into a first type of operating stage; if the estimated operating power consumptions corresponding to the operating nodes L35 to L45 are all less than the power consumption threshold, then the operating nodes L35 to L45 are classified into a second type of operating stage, and so on. The N operating nodes included in the neural network model can be respectively classified into a first type of operating stage and a second type of operating stage.

[0080] Step 203, in response to the neural network model running to the first type of operating stage, use the first memory to access neural network data.

[0081] Since the first memory can be a system cache or a system buffer memory, for different first memories, there are also differences in the access process of accessing neural network data.

[0082] As Figure 5 shown, it shows a schematic diagram of the process of accessing neural network data through the system cache and DRAM shown in an exemplary embodiment of the present application. Among them, the system cache 520 is located between the DRAM 530 and the processor 510, that is, the system cache 520 is respectively connected to the DRAM 530 and the processor 510 through a bus. The processor 510 may include a CPU 511, an NPU 512, and an ISP 513. The DRAM 530 is a second memory; when the neural network model runs to the first type of operating stage, the neural network data can be stored in the system cache 520, and the writing of the neural network data into the DRAM 530 is stopped. Correspondingly, the processor 510 can read the neural network data from the system cache 520; when the neural network model runs to the second type of operating stage, the neural network data can be written into the DRAM 530 through the system cache 520. Correspondingly, the processor 510 can read the neural network data from the DRAM 530 through the system cache 520.

[0083] As Figure 6As shown, it shows a schematic diagram of the process of accessing neural network data through a system buffer memory shown in an exemplary embodiment of the present application. Among them, the system buffer memory 620 and the DRAM 630 are independent of each other. That is, the DRAM 630 is connected to the processor 610 through a bus, the system buffer memory 630 is connected to the processor 610 through a bus, the processor 610 may include a CPU 611, an NPU 612, and an ISP 613, and the DRAM 630 is the second memory; when the neural network model runs to the first type of running stage, the neural network data can be stored in the system buffer memory 620, and correspondingly, the processor 610 can read the neural network data from the system buffer memory 620; when the neural network model runs to the second type of running stage, the neural network data can be stored in the DRAM 630, and correspondingly, the processor 610 reads the neural network data from the DRAM 630.

[0084] Optionally, the system cache may not be connected to the DRAM. Correspondingly, when the neural network model runs to the first type of running stage, the neural network data can be stored in the system cache, and the corresponding processor can read the neural network data from the system cache; when the neural network model runs to the second type of running stage, the neural network data can be stored in the DRAM, and the corresponding processor reads the neural network data from the DRAM.

[0085] Step 204, in response to the neural network model running to the second type of running stage, use the second memory to access the neural network data, and the data access power consumption of the first memory is lower than that of the second memory.

[0086] Based on the fact that when calculating the estimated running power consumption corresponding to the neural network model, it is determined by superimposing the estimated running power consumptions of the initial data, intermediate feature data, and result data. Correspondingly, when dividing the first type of running stage and the second type of running stage, it can also be mapped to the access stages of different neural network data. That is to say, according to the division conditions of the first type of running progress and the second type of running progress, the data cache location divisions corresponding to each running node in the initial data, the data cache location division corresponding to the intermediate feature data, and the data cache location division corresponding to the result data are respectively determined.

[0087] In an exemplary example, such as Figure 7As shown, it shows a schematic diagram of the division of data cache locations corresponding to different neural network data shown in an exemplary embodiment of the present application. According to the first type of operation stage and the second type of operation stage, the location division of the initial data cache 31, the location division of the intermediate feature image 1 cache 32, the location division of the intermediate feature image 2 cache 33, and the location division of the result data cache 34 are determined. In the initial data cache 31, the dot pattern marked on the left oblique line pattern is the portion of the initial data cached in the first memory, and the remaining portion is the portion of the initial data cached in the second memory; in the intermediate feature image 1 cache 32, the dot pattern marked on the square pattern is the portion of the intermediate feature image 1 cached in the first memory, and the remaining portion is the portion of the intermediate feature image 1 cached in the second memory; in the intermediate feature image 2 cache 33, the dot pattern marked on the oblique square pattern is the portion of the intermediate feature image 2 cached in the first memory, and the remaining portion is the portion of the intermediate feature image 2 cached in the second memory; in the result data cache 34, the dot pattern marked on the right oblique line pattern is the portion of the result data cached in the first memory, and the remaining portion is the portion of the result data cached in the second memory.

[0088] based on Figure 7 The division of data cache locations corresponding to different neural network data shown in FIG. 1 is an exemplary example, as shown in FIG. Figure 8 As shown, it shows a schematic diagram of the difference between the data access solution of all DRAM and the data access solution of DRAM combined with Sys$ / SysBuf. In the related art, DRAM is used to access neural network data in all operating stages, while in this application, the terminal determines 4 first-class operating stages and 4 second-class operating stages based on the power consumption threshold, and determines to use Sys$ or SysBuf to access neural network data in the first-class operating stage, and determines to use DRAM to access neural network data in the second-class operating stage.

[0089] In this embodiment, simulation operations are performed on the neural network model to determine the estimated operating power consumption corresponding to the neural network model; in addition, based on the division of the neural network data corresponding to the neural network model, in the process of estimating the operating power consumption, the estimated operating power consumption corresponding to different neural network data is superimposed to obtain the overall estimated operating power consumption corresponding to the neural network model.

[0090] Since the simulation operation process of the neural network model requires a certain amount of time, if the neural network model needs to be simulated before each operation, it will obviously reduce the operating efficiency of the neural network model and increase the power consumption of the terminal. Therefore, in a possible implementation method, the estimated operating power consumption corresponding to the neural network model and its corresponding model identifier can be associated and stored in the terminal, so that when the neural network model is subsequently operated, the corresponding estimated operating power consumption can be directly obtained based on the model identifier.

[0091] exist Figure 2 On the basis of Figure 9 As shown, step 201 can be replaced by steps 901 to 903.

[0092] Step 901: Obtain a model identifier corresponding to the neural network model.

[0093] In one possible implementation, the terminal stores a correspondence between model identifiers corresponding to different neural network models and their corresponding estimated operating power consumption. Correspondingly, when the terminal has an operating requirement for the neural network model, it can preferentially obtain the model identifier corresponding to the neural network model, so as to search based on the model identifier whether the estimated operating power consumption corresponding to the model identifier is pre-stored.

[0094] Among them, the model identifier can be the model name corresponding to the neural network model, or the model number corresponding to the neural network model, or an identifier that uniquely identifies the neural network model. The embodiment of the present application does not limit the type of model identifier.

[0095] Step 902 , in response to the absence of a candidate model identifier that matches the model identifier in the correspondence table, simulate the neural network model to obtain the estimated operating power consumption corresponding to the neural network model at different network operating stages during the simulation process.

[0096] The correspondence table includes the correspondence between the candidate neural network models and the candidate estimated operating power consumption. For example, the correspondence table can be shown in Table 1:

[0097] Table 1

[0098] Model Identification Estimated Operating Power Consumption Model A Power Consumption Curve A Model B Power Consumption Curve B Model C Power Consumption Curve C

[0099] As shown in Table 1, the terminal pre-stores estimated operating power consumption information corresponding to different neural network models. In order to avoid the terminal from repeatedly simulating the estimated operating power consumption of existing neural network models, in one possible implementation, the terminal first searches the correspondence table according to the model identifier corresponding to the neural network model to be run to determine whether the terminal has stored the estimated operating power consumption information corresponding to the neural network model.

[0100] Optionally, if there is no candidate model identifier matching the model identifier in the correspondence table, it means that the correspondence table does not store the estimated operating power consumption information corresponding to the neural network model. At this time, the terminal can perform a simulation operation on the neural network model to obtain the estimated operating power consumption corresponding to the neural network model at different network operation stages during the simulation operation.

[0101] Optionally, in order to avoid repeating the simulation operation on the neural network model when the neural network model is run again, after the simulation operation on the neural network model, the estimated operating power consumption can be associated and stored in the correspondence table with the model identifier corresponding to the neural network model, so that when the neural network model is run later, the estimated operating power consumption corresponding to the neural network model can be directly retrieved from the correspondence table according to the model identifier corresponding to the neural network model.

[0102] Step 903, in response to the existence of a candidate model identifier matching the model identifier, determine the candidate estimated operating power consumption corresponding to the candidate model identifier as the estimated operating power consumption corresponding to the neural network.

[0103] In a possible implementation manner, if the terminal searches in the correspondence table according to the model identifier and determines that there is a candidate model identifier corresponding to the model identifier in the correspondence table, it means that the correspondence table stores the estimated operating power consumption corresponding to the neural network model, and correspondingly, the candidate estimated operating power consumption corresponding to the candidate model identifier can be directly determined as the estimated operating power consumption corresponding to the neural network model.

[0104] In this embodiment, the terminal stores a correspondence table between multiple neural network models and their corresponding estimated operating power consumptions. When obtaining the estimated operating power consumption corresponding to the neural network model, the terminal first searches in the correspondence table according to the model identifier corresponding to the neural network model. If there is no candidate model identifier matching the model identifier, then perform a simulation operation on the neural network model to obtain its corresponding estimated operating power consumption; if there is a candidate model identifier matching the model identifier, the candidate estimated operating power consumption corresponding to the candidate model identifier can be directly used without performing a simulation operation on the neural network model, improving the operating efficiency of the neural network model. In addition, after the terminal performs a simulation operation on the neural network model, the obtained estimated operating power consumption and the model identifier corresponding to the neural network model can be associated and stored in the correspondence table, so that when the neural network model is run later, the estimated operating power consumption can be directly obtained from the correspondence table, avoiding repeated simulation operations on the neural network model and further improving the operating efficiency of the neural network model.

[0105] Since the estimated operating power consumption corresponding to the neural network model is mainly affected by the structure of the neural network model, there are cases where the structural differences between some neural network models are small, and the differences in the estimated operating power consumption between neural network models with small structural differences are also small. To further improve the operating efficiency of the terminal in running the neural network model, in another possible implementation, if there is no candidate model identifier in the correspondence table that matches the model identifier, the candidate estimated operating power consumption corresponding to another neural network model with a relatively high similarity to the neural network model can be directly used as the estimated operating power consumption corresponding to the neural network model.

[0106] In an exemplary example, based on Figure 9 as shown in Figure 10 Step 902 can be replaced by Step 1001 and Step 1002.

[0107] Step 1001, in response to the absence of a candidate model identifier in the correspondence table that matches the model identifier, determine the model similarity between the neural network model and each candidate neural network model, where the model similarity is determined by the structural differences between the neural network model and the candidate neural network model.

[0108] To further improve the operating efficiency when running the neural network model, in one possible implementation, when there is no candidate model identifier in the correspondence table that matches the model identifier, it means that the estimated operating power consumption corresponding to the neural network model is not pre-stored in the terminal. At this time, the model similarity between the neural network model and each candidate neural network model in the correspondence table can be compared, so as to determine the estimated operating power consumption corresponding to the neural network model from the correspondence table according to this model similarity.

[0109] For the method of comparing the model similarity between the neural network model and each candidate neural network model, it can be determined by comparing the structural differences between the neural network model and each candidate neural network model. For example, it can be determined by comparing the differences in the quantity and structure of network structures such as convolutional layers, fully connected layers, and pooling layers included in different neural networks.

[0110] Step 1002, in response to the existence of at least one candidate neural network model whose model similarity to the neural network model is greater than the similarity threshold, determine the estimated operating power consumption corresponding to the neural network model according to the candidate estimated operating power consumption corresponding to the at least one candidate neural network model.

[0111] Among them, the similarity threshold can be set by developers. For example, the similarity threshold can be 95%.

[0112] In one possible implementation, if the similarity between the candidate neural network model and the neural network model is high and higher than the similarity threshold, it means that the structural difference between the neural network model and the candidate neural network model is small, and the estimated operating power consumption difference between the corresponding neural network model and the candidate neural network model is also small. If the difference allows, the estimated operating power consumption corresponding to the candidate neural network model can be determined as the estimated operating power consumption corresponding to the neural network model.

[0113] In an illustrative example, the terminal pre-stores candidate estimated operating power consumptions corresponding to candidate neural network models A to candidate neural network model D. By comparing the model similarities between the neural network model and each candidate neural network model, it can be obtained that the model similarity between the neural network model and the candidate neural network model A is 50%, the model similarity between the neural network model and the candidate neural network model B is 98%, the model similarity between the neural network model and the candidate neural network model A is 40%, and the model similarity between the neural network model and the candidate neural network model A is 80%. It can be seen that the model similarity between the candidate neural network model B and the neural network model is greater than the similarity threshold of 95%, and the candidate estimated operating power consumption corresponding to the candidate neural network model B is determined as the estimated operating power consumption corresponding to the neural network model.

[0114] Optionally, if it is determined that the model similarity between at least two candidate neural network models and the neural network model is greater than the similarity threshold, the estimated operating power consumption corresponding to the candidate neural network model with the highest model similarity is determined as the estimated operating power consumption corresponding to the neural network model.

[0115] In this embodiment, when the estimated operating power consumption corresponding to the neural network model is not pre-stored in the terminal, by comparing the model similarity between the neural network model and each candidate neural network model (the neural network model pre-stored in the terminal), the candidate neural network model with a model similarity higher than the similarity threshold is selected, and the corresponding candidate estimated operating power consumption is determined as the estimated operating power consumption corresponding to the neural network model, thereby avoiding simulation operations on the neural network model and improving the operating efficiency of the neural network model.

[0116] The following are device embodiments of the present application, which can be used to implement the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.

[0117] Please refer to Figure 11 , which shows a block diagram of a neural network operating device provided by an exemplary embodiment of the present application. The device can be implemented as all or part of a terminal through software, hardware, or a combination of both. The device includes:

[0118] An acquisition module 1101 is configured to acquire estimated operating power consumption corresponding to different network operation stages of a neural network model, wherein the network operation stage refers to the completion progress of the neural network model inference process;

[0119] a dividing module 1102, configured to divide the network operation stage corresponding to the neural network model into a first type of operation stage and a second type of operation stage based on the estimated operation power consumption and the power consumption threshold, wherein the estimated operation power consumption corresponding to the first type of operation stage is higher than the power consumption threshold, and the estimated operation power consumption corresponding to the second type of operation stage is lower than the power consumption threshold;

[0120] A first access module 1103 is configured to access neural network data using a first memory in response to the neural network model running to the first type of running stage; and

[0121] The second access module 1104 is used to use the second memory to access the neural network data in response to the neural network model running to the second type of operation stage, and the data access power consumption of the first memory is lower than the data access power consumption of the second memory.

[0122] Optionally, the acquisition module 1101 includes:

[0123] The processing unit is used to perform simulation operations on the neural network model to obtain the estimated operating power consumption corresponding to the neural network model at different network operation stages during the simulation operation.

[0124] Optionally, the neural network data includes initial data, intermediate feature data and result data;

[0125] The processing unit is further configured to:

[0126] Performing simulation operations on the neural network model to obtain a first estimated operating power consumption corresponding to when the neural network model reads the initial data at different network operation stages, a second estimated operating power consumption corresponding to when the neural network model accesses the intermediate feature data, and a third estimated operating power consumption corresponding to when the neural network model writes the result data; and

[0127] The first estimated operating power consumption, the second estimated operating power consumption and the third estimated operating power consumption are superimposed according to the network operation stage to obtain the estimated operating power consumption corresponding to the neural network model in different network operation stages.

[0128] Optionally, the processing unit is further configured to:

[0129] Obtaining a model identifier corresponding to the neural network model; and

[0130] In response to the absence of a candidate model identifier matching the model identifier in the correspondence table, a simulation operation is performed on the neural network model to obtain the estimated operating power consumption corresponding to the neural network model in different network operation stages during the simulation operation. The correspondence table contains the correspondence between the candidate neural network models and the candidate estimated operating power consumption.

[0131] Optionally, the device further includes:

[0132] a first determining module, configured to determine, in response to the absence of the candidate model identifier matching the model identifier in the correspondence table, a model similarity between the neural network model and each of the candidate neural network models, wherein the model similarity is determined by a structural difference between the neural network model and the candidate neural network models; and

[0133] The second determination module is used to determine the estimated operating power consumption corresponding to the neural network model based on the candidate estimated operating power consumption corresponding to at least one of the candidate neural network models in response to the existence of a model similarity between at least one of the candidate neural network models and the neural network model that is greater than a similarity threshold.

[0134] Optionally, the device further includes:

[0135] The third determination module is used to determine the candidate estimated operating power consumption corresponding to the candidate model identifier as the estimated operating power consumption corresponding to the neural network model in response to the existence of the candidate model identifier matching the model identifier.

[0136] Optionally, the device further includes:

[0137] A storage module is used to associate the estimated operating power consumption with the model identifier corresponding to the neural network model and store it in the correspondence table.

[0138] Optionally, the first memory includes at least one of a system cache and a system buffer memory; and the second memory includes a dynamic random access memory.

[0139] To sum up, based on the structural characteristics of the neural network, by pre-acquiring the estimated operating power consumption corresponding to different network operation stages when running the neural network model, so that in the actual operation of the neural network model, the data storage location of the neural network data required by the neural network model during the operation can be determined according to the relationship between the estimated operating power consumption and the preset power consumption threshold. For example, when the operating power consumption is high, the neural network data can be accessed by using a memory with low data access power consumption, and the operating power consumption of the neural network model can be reduced by reducing the data access power consumption of the neural network data, thereby ensuring that the processor works at saturation when running the neural network model, while avoiding high-speed access to the neural network data, which leads to increased system power consumption and abnormal heating of the system, thereby ensuring the system's operating performance.

[0140] It should be noted that the neural network operating device provided in the above embodiment, when executing the neural network operating method, is merely illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the neural network operating device provided in the above embodiment and the neural network operating method embodiment are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0141] Please refer to Figure 12 , which shows a block diagram of the structure of a terminal 1200 provided in an exemplary embodiment of the present application. The terminal 1200 can be an electronic device such as a smartphone, tablet computer, e-book, or portable personal computer that has an application installed and running. The terminal 1200 in the present application may include one or more of the following components: a processor 1202 and a memory 1201.

[0142] The processor 1202 may include one or more processing cores. The processor 1102 is connected to various parts within the entire terminal 1200 through various interfaces and lines. By running or executing instructions, programs, code sets, or instruction sets stored in the memory 1201, and by invoking data stored in the memory 1201, it performs various functions of the terminal 1200 and processes data. Optionally, the processor 1202 may be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), or programmable logic array (PLA). The processor 1202 may integrate one or a combination of several of a CPU, GPU, and modem, etc. Among them, the CPU mainly processes the operating system, user interface, application programs, etc.; the GPU is responsible for the rendering and drawing of the content to be displayed on the touch display screen 1203; the modem is used to process wireless communication. It can be understood that the above modem may not be integrated into the processor 1202 and may be implemented separately through a communication chip.

[0143] In the embodiments of this application, the processor 1201 is a processor with neural network operation function, which may be a CPU, NPU, DSP, GPU, etc.

[0144] The memory 1201 may include random access memory (RAM) and may also include read-only memory (ROM). Optionally, the memory 1201 includes a non-transitory computer-readable storage medium. The memory 1201 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 1201 may include a program storage area and a data storage area. Among them, the program storage area may store instructions for implementing the operating system, instructions for implementing at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above various method embodiments, etc. The operating system may be the Android system (including systems developed based on the Android system in depth), the IOS system developed by Apple Inc. (including systems developed based on the IOS system in depth), or other systems. The data storage area may also store data created during the use of the terminal 1200 (such as phone books, audio and video data, chat record data, etc.).

[0145] In the embodiment of the present application, the memory 1201 is used to store neural network data. Optionally, the memory 1201 may include a first memory and a second memory, wherein the first memory may be a system cache or a system buffer memory, and the second memory may be a DRAM.

[0146] Optionally, the terminal 1200 may further include a touch screen display, which is used to receive touch operations on or near the terminal 1200 using any suitable object such as a finger or a stylus, and to display the user interface of each application. The touch screen display is typically provided on the front panel of the terminal 1200. The touch screen display can be designed as a full screen, a curved screen, or a special-shaped screen. The touch screen display can also be designed as a combination of a full screen and a curved screen, or a combination of a special-shaped screen and a curved screen, which is not limited in the embodiments of the present application.

[0147] In addition, those skilled in the art will appreciate that the structure of terminal 1200 shown in the above figures does not limit terminal 1200. The terminal may include more or fewer components than shown, or may combine certain components, or arrange the components differently. For example, terminal 1200 also includes RF circuits, camera components, sensors, audio circuits, Wireless Fidelity (WiFi) components, power supplies, Bluetooth components, and other components, which will not be described in detail here.

[0148] An embodiment of the present application further provides a computer-readable medium storing at least one instruction, wherein the at least one instruction is loaded and executed by the processor to implement the method for operating the neural network as described in the above embodiments.

[0149] According to one aspect of the present application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the neural network operation method provided in various optional implementations of the above aspects.

[0150] It should be understood that the "plurality" mentioned herein refers to two or more. "And / or" describes the association relationship of associated objects and indicates that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally represents an "or" relationship between the associated objects before and after. In addition, the step numbers described herein only exemplarily show a possible execution sequence between steps. In some other embodiments, the above steps may not be executed in the numbered order. For example, two steps with different numbers can be executed simultaneously, or two steps with different numbers can be executed in the reverse order of the illustration. The embodiments of the present application do not make any limitations in this regard.

[0151] The above are only optional embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application shall be included within the protection scope of the present application.

Claims

1. A method for operating a neural network, characterized in that The method includes: Obtaining a model identifier corresponding to a neural network model; In response to the non - existence of a candidate model identifier matching the model identifier in a correspondence table, determining a model similarity between the neural network model and each candidate neural network model, where the correspondence table includes the correspondence between the candidate neural network models and candidate estimated operating power consumptions, and the model similarity is determined by the structural difference between the neural network model and the candidate neural network models; In response to there being at least one candidate neural network model with a model similarity greater than a similarity threshold with the neural network model, determining the estimated operating power consumption corresponding to the neural network model according to the candidate estimated operating power consumptions corresponding to at least one of the candidate neural network models; Based on the estimated operating power consumption and a power consumption threshold, dividing the network operation stage corresponding to the neural network model into a first - type operation stage and a second - type operation stage, where the estimated operating power consumption corresponding to the first - type operation stage is higher than the power consumption threshold, and the estimated operating power consumption corresponding to the second - type operation stage is lower than the power consumption threshold; In response to the neural network model running to the first - type operation stage, using a first memory to access neural network data; and In response to the neural network model running to the second - type operation stage, using a second memory to access the neural network data, where the data access power consumption of the first memory is lower than that of the second memory.

2. The method according to claim 1, wherein The method further includes: In response to the non - existence of a candidate model identifier matching the model identifier in the correspondence table, performing a simulation operation on the neural network model to obtain the estimated operating power consumptions corresponding to the neural network model at different network operation stages during the simulation operation.

3. The method according to claim 2, wherein The neural network data includes initial data, intermediate feature data, and result data; The performing a simulation operation on the neural network model to obtain the estimated operating power consumptions corresponding to the neural network model at different network operation stages during the simulation operation includes: Performing a simulation operation on the neural network model to obtain a first estimated operating power consumption corresponding to the neural network model when reading the initial data, a second estimated operating power consumption corresponding to accessing the intermediate feature data, and a third estimated operating power consumption corresponding to writing out the result data at different network operation stages; and Superposing the first estimated operating power consumption, the second estimated operating power consumption, and the third estimated operating power consumption according to the corresponding network operation stages to obtain the estimated operating power consumptions corresponding to the neural network model at different network operation stages.

4. The method according to claim 1, characterized in that, After obtaining the model identifier corresponding to the neural network model, the method further includes: In response to the existence of a candidate model identifier matching the model identifier, determining the candidate estimated operating power consumption corresponding to the candidate model identifier as the estimated operating power consumption corresponding to the neural network model.

5. The method according to claim 1, wherein After performing a simulation operation on the neural network model to obtain the estimated operating power consumption corresponding to the neural network model at different network operation stages during the simulation operation, the method further includes: Associatively storing the estimated operating power consumption and the model identifier corresponding to the neural network model in the correspondence table.

6. The method according to any one of claims 1 to 5, characterized in that The first memory includes at least one of a system cache and a system buffer memory; the second memory includes a dynamic random access memory.

7. An operating device for a neural network, characterized in that, The apparatus includes: An acquisition module, configured to acquire a model identifier corresponding to a neural network model; determine a model similarity between the neural network model and each candidate neural network model in response to the absence of a candidate model identifier matching the model identifier in the correspondence table, where the correspondence table includes a correspondence between the candidate neural network model and the candidate estimated operating power consumption, and the model similarity is determined by a structural difference between the neural network model and the candidate neural network model; in response to the existence of at least one candidate neural network model having a model similarity greater than a similarity threshold with the neural network model, determine the estimated operating power consumption corresponding to the neural network model according to the candidate estimated operating power consumption corresponding to at least one candidate neural network model; A partitioning module, configured to partition the network operation stage corresponding to the neural network model into a first type of operation stage and a second type of operation stage based on the estimated operating power consumption and a power consumption threshold, where the estimated operating power consumption corresponding to the first type of operation stage is higher than the power consumption threshold, and the estimated operating power consumption corresponding to the second type of operation stage is lower than the power consumption threshold; A first access module, configured to access neural network data using a first memory in response to the neural network model running to the first type of operation stage; and A second access module, configured to access the neural network data using a second memory in response to the neural network model running to the second type of operation stage, where the data access power consumption of the first memory is lower than that of the second memory.

8. A terminal, characterized in that, The terminal includes: A processor; A memory, where program instructions are stored on the memory, and when the processor executes the program instructions, the running method of the neural network as described in any one of claims 1 to 6 is implemented.

9. A computer-readable storage medium, characterized in that, Program instructions are stored in the computer-readable storage medium, and when the program instructions are executed by a processor, the running method of the neural network as described in any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • FPGA dynamic power consumption estimation method based on BP neural network

    CN104199536A

  • Neural network power management in a multi-GPU system

    US20200073461A1

  • Calculating apparatus and method

    WO2018121118A1

  • KR20200111948A