Method, device and storage medium for determining execution code of deep learning model

By optimizing the data processing method and cache optimization of the intermediate code of the deep learning model, efficient execution code is generated, which solves the problem of low operating efficiency of the deep learning model on different hardware platforms and achieves efficient execution suitable for a variety of scenarios. .

CN113031952BActive Publication Date: 2024-10-11HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201911356174.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-12-25
Publication Date
2024-10-11
Estimated Expiration
2039-12-25

AI Technical Summary

Technical Problem

The execution code of the deep learning model runs poorly on different hardware platforms, mainly because the existing code conversion process is single and cannot fully utilize the characteristics of the hardware platform.

Method used

By optimizing the data processing method of the intermediate code of the deep learning model, different preprocessing intermediate codes are generated, and the cache optimization technology such as double cache and ring cache optimization is used to convert it into executable code to determine efficient execution. code.

Benefits of technology

It improves the operating efficiency of deep learning models on different hardware platforms, avoids the problem of low efficiency in fixed modes, and is suitable for various scenarios such as target detection, semantic segmentation, and speech recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113031952B_ABST
    Figure CN113031952B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device and storage medium for determining the execution code of a deep learning model, and belongs to the field of data processing technology. The method includes: based on the data processing method of the intermediate code of the deep learning model, determining at least one pre-processing intermediate code corresponding to the intermediate code, at least one pre-processing intermediate code is different from each other; converting each pre-processing intermediate code into an executable code to obtain at least one executable code; determining the execution code of the deep learning model from the at least one executable code. The present application determines at least one pre-processing intermediate code according to the different data processing methods of the intermediate code, thereby obtaining at least one executable code, so that the execution code of the deep learning model with the highest operating efficiency can be determined from at least one executable code, avoiding the problem that the execution code of the deep learning model can only be determined according to a fixed mode.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a method, device and storage medium for determining an execution code of a deep learning model. Background Art

[0002] With the rapid development of data processing technology, deep learning models are widely used in computer vision, natural language processing and other fields. Generally speaking, the source code of deep learning models cannot be applied to different types of hardware platforms. Therefore, it is usually necessary to convert the source code of deep learning models into intermediate code during use, and then convert the intermediate code into executable code of the hardware platform based on the configuration file of the specific hardware platform to obtain the execution code of the deep learning model that can run on the hardware platform.

[0003] However, the code conversion process provided above is performed according to a fixed mode, and the method for determining the execution code of the deep learning model is relatively simple, which makes the running efficiency of the execution code of the deep learning model relatively poor. Summary of the invention

[0004] The present application provides a method, apparatus, device and storage medium for determining the execution code of a deep learning model, which can solve the problem of poor operating efficiency of the execution code of the deep learning model in the related art.

[0005] The technical solution is as follows:

[0006] In one aspect, a method for determining an execution code of a deep learning model is provided, the method comprising:

[0007] Determine at least one pre-processed intermediate code corresponding to the intermediate code based on a data processing method of the intermediate code of the deep learning model, wherein the data processing method includes data reuse and / or data non-reuse, and the at least one pre-processed intermediate code is different from each other;

[0008] Convert each preprocessed intermediate code into an executable code to obtain at least one executable code;

[0009] An execution code of the deep learning model is determined from the at least one executable code.

[0010] In a possible implementation of the present application, the method is applied to any scenario of target detection, target tracking, semantic segmentation, speech recognition, text recognition, and natural language processing.

[0011] In a possible implementation of the present application, the intermediate code includes a plurality of intermediate code blocks, each intermediate code block is used to process different tensor data, and the data processing method of the intermediate code based on the deep learning model determines at least one pre-processing intermediate code corresponding to the intermediate code, including:

[0012] Using the intermediate code as a preprocessed intermediate code; and / or,

[0013] Based on the data processing mode of each intermediate code block, performing cache optimization processing on at least one intermediate code block among the multiple intermediate code blocks;

[0014] The intermediate code composed of at least one intermediate code block after the cache optimization process and all the intermediate code blocks that have not been subjected to the cache optimization process is used as a preprocessed intermediate code.

[0015] In a possible implementation of the present application, the cache optimization processing of at least one of the multiple intermediate code blocks based on the data processing method of each intermediate code block includes:

[0016] When the data processing modes of the plurality of intermediate code blocks all include non-reuse of data, performing double-buffer optimization processing on at least one of the plurality of intermediate code blocks;

[0017] The intermediate code consisting of at least one intermediate code block after the cache optimization process and all intermediate code blocks not subjected to the cache optimization process is used as a preprocessed intermediate code, including:

[0018] The intermediate code composed of at least one intermediate code block after the double-buffer optimization process and all intermediate code blocks not subjected to the double-buffer optimization process is used as a pre-processed intermediate code.

[0019] In a possible implementation of the present application, the cache optimization processing of at least one of the multiple intermediate code blocks based on the data processing method of each intermediate code block includes:

[0020] When the data processing mode of some of the intermediate code blocks among the multiple intermediate code blocks includes data reuse, and the data processing mode of some of the intermediate code blocks among the multiple intermediate code blocks includes data non-reuse, performing double cache optimization processing on at least one of the multiple intermediate code blocks whose data processing mode includes data non-reuse, and performing ring cache optimization processing on at least one of the multiple intermediate code blocks whose data processing mode includes data reuse;

[0021] The intermediate code consisting of at least one intermediate code block after the cache optimization process and all intermediate code blocks not subjected to the cache optimization process is used as a preprocessed intermediate code, including:

[0022] The intermediate code composed of at least one intermediate code block after double cache optimization processing, at least one intermediate code block after ring cache optimization processing and all intermediate code blocks not subjected to cache optimization processing is used as a preprocessed intermediate code.

[0023] In a possible implementation of the present application, the cache optimization processing of at least one of the multiple intermediate code blocks based on the data processing method of each intermediate code block includes:

[0024] When the data processing methods of the plurality of intermediate code blocks all include data reuse, performing a ring cache optimization process on at least one of the plurality of intermediate code blocks;

[0025] The intermediate code consisting of at least one intermediate code block after the cache optimization process and all intermediate code blocks not subjected to the cache optimization process is used as a preprocessed intermediate code, including:

[0026] The intermediate code composed of at least one intermediate code block after the ring cache optimization process and all the intermediate code blocks not subjected to the ring cache optimization process is used as a preprocessed intermediate code.

[0027] In a possible implementation of the present application, determining the execution code of the deep learning model from the at least one executable code includes:

[0028] Determine the execution performance index of each executable code based on the tensor data to be tested;

[0029] Based on the execution performance indicator of each executable code, an execution code of the deep learning model is determined from the at least one executable code.

[0030] In a possible implementation of the present application, the operation of performing double-buffer optimization processing on an intermediate code block in the intermediate code includes the following steps:

[0031] Change some node information in the syntax tree so that the changed intermediate code block supports the following operations:

[0032] Alternately cache input data into two input caches, and perform calculation processing using the input cache of the two input caches that is not currently performing a cache operation each time the data is cached;

[0033] Record the cache position of the first input data in the two input caches;

[0034] Alternately caching the calculated and processed data into two output caches, and outputting the data in the output caches that are not currently performing the caching operation in the two output caches during each caching operation;

[0035] The syntax tree is used to indicate the operation logic of the intermediate code block, and each node information in the syntax tree is used to indicate an operation step of the intermediate code block.

[0036] In a possible implementation of the present application, the operation of performing a ring cache optimization process on an intermediate code block in the intermediate code includes the following steps:

[0037] Change some node information in the syntax tree so that the changed intermediate code block supports the following operations:

[0038] Perform circular buffering on input data;

[0039] Alternately caching the data processed by the ring buffer into two output buffers, and outputting the data in the output buffers that are not currently performing the caching operation in the two output buffers during each caching;

[0040] The syntax tree is used to indicate the operation logic of the intermediate code block, and each node information in the syntax tree is used to indicate an operation step of the intermediate code block.

[0041] On the other hand, a device for determining an execution code of a deep learning model is provided, the device comprising:

[0042] A first determination module is used to determine at least one pre-processed intermediate code corresponding to the intermediate code based on a data processing method of the intermediate code of the deep learning model, wherein the data processing method includes data reuse and / or data non-reuse, and the at least one pre-processed intermediate code is different from each other;

[0043] A conversion module, used for converting each preprocessed intermediate code into an executable code to obtain at least one executable code;

[0044] The second determination module is used to determine the execution code of the deep learning model from the at least one executable code.

[0045] In a possible implementation of the present application, the device is applied to any scenario of target detection, target tracking, semantic segmentation, speech recognition, text recognition, and natural language processing.

[0046] In a possible implementation of the present application, the intermediate code includes a plurality of intermediate code blocks, each intermediate code block is used to process different tensor data, and the first determination module is used to:

[0047] Using the intermediate code as a preprocessed intermediate code; and / or,

[0048] Based on the data processing mode of each intermediate code block, performing cache optimization processing on at least one intermediate code block among the multiple intermediate code blocks;

[0049] The intermediate code composed of at least one intermediate code block after the cache optimization process and all the intermediate code blocks that have not been subjected to the cache optimization process is used as a preprocessed intermediate code.

[0050] In a possible implementation of the present application, the first determining module is used to:

[0051] When the data processing modes of the plurality of intermediate code blocks all include non-reuse of data, performing double-buffer optimization processing on at least one of the plurality of intermediate code blocks;

[0052] The intermediate code composed of at least one intermediate code block after the double-buffer optimization process and all intermediate code blocks not subjected to the double-buffer optimization process is used as a pre-processed intermediate code.

[0053] In a possible implementation of the present application, the first determining module is used to:

[0054] When the data processing mode of some of the intermediate code blocks among the multiple intermediate code blocks includes data reuse, and the data processing mode of some of the intermediate code blocks among the multiple intermediate code blocks includes data non-reuse, performing double cache optimization processing on at least one of the multiple intermediate code blocks whose data processing mode includes data non-reuse, and performing ring cache optimization processing on at least one of the multiple intermediate code blocks whose data processing mode includes data reuse;

[0055] The intermediate code composed of at least one intermediate code block after double cache optimization processing, at least one intermediate code block after ring cache optimization processing and all intermediate code blocks not subjected to cache optimization processing is used as a preprocessed intermediate code.

[0056] In a possible implementation of the present application, the first determining module is used to:

[0057] When the data processing methods of the plurality of intermediate code blocks all include data reuse, performing a ring cache optimization process on at least one of the plurality of intermediate code blocks;

[0058] The intermediate code composed of at least one intermediate code block after the ring cache optimization process and all the intermediate code blocks not subjected to the ring cache optimization process is used as a preprocessed intermediate code.

[0059] In a possible implementation of the present application, the second determining module is used to:

[0060] Determine the execution performance index of each executable code based on the tensor data to be tested;

[0061] Based on the execution performance indicator of each executable code, an execution code of the deep learning model is determined from the at least one executable code.

[0062] In a possible implementation of the present application, the first determining module is used to:

[0063] Change some node information in the syntax tree so that the changed intermediate code block supports the following operations:

[0064] Alternately cache input data into two input caches, and perform calculation processing using the input cache of the two input caches that is not currently performing a cache operation each time the data is cached;

[0065] Record the cache position of the first input data in the two input caches;

[0066] Alternately caching the calculated and processed data into two output caches, and outputting the data in the output caches that are not currently performing the caching operation in the two output caches during each caching operation;

[0067] The syntax tree is used to indicate the operation logic of the intermediate code block, and each node information in the syntax tree is used to indicate an operation step of the intermediate code block.

[0068] In a possible implementation of the present application, the first determining module is used to:

[0069] Change some node information in the syntax tree so that the changed intermediate code block supports the following operations:

[0070] Perform circular buffer processing on input data;

[0071] Alternately caching the data processed by the ring buffer into two output buffers, and outputting the data in the output buffers that are not currently performing the caching operation in the two output buffers during each caching;

[0072] The syntax tree is used to indicate the operation logic of the intermediate code block, and each node information in the syntax tree is used to indicate an operation step of the intermediate code block.

[0073] On the other hand, an electronic device is provided, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus, the memory is used to store computer programs, and the processor is used to execute the programs stored in the memory, so as to implement the steps of the method for determining the execution code of the deep learning model described in the above-mentioned first aspect.

[0074] On the other hand, a computer-readable storage medium is provided, wherein a computer program is stored in the storage medium, and when the computer program is executed by a processor, the steps of the method for determining the execution code of the deep learning model described in the above-mentioned first aspect are implemented.

[0075] The technical solution provided by this application can at least bring the following beneficial effects:

[0076] The data processing method of the intermediate code of the deep learning model may include data reuse and / or data non-reuse. According to different data processing methods of the intermediate code, at least one different pre-processing intermediate code corresponding to the intermediate code can be determined. Each pre-processing intermediate code is converted into an executable code to obtain at least one executable code, so that an execution code of a deep learning model with high operating efficiency can be determined from the at least one executable code, avoiding the problem that the execution code of the deep learning model can only be determined according to a fixed mode. BRIEF DESCRIPTION OF THE DRAWINGS

[0077] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. 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 creative work.

[0078] Figure 1 It is a flowchart of a method for determining an execution code of a deep learning model provided in an embodiment of the present application;

[0079] Figure 2 is a schematic diagram of a double buffer optimization process provided by an embodiment of the present application;

[0080] Figure 3 is a schematic diagram of another double buffer optimization process provided by an embodiment of the present application;

[0081] Figure 4 is a schematic diagram of another double buffer optimization process provided by an embodiment of the present application;

[0082] Figure 5 is a schematic diagram of another double buffer optimization process provided by an embodiment of the present application;

[0083] Figure 6 It is a schematic diagram of a ring cache optimization process provided by an embodiment of the present application;

[0084] Figure 7 is a schematic diagram of another ring cache optimization process provided by an embodiment of the present application;

[0085] Figure 8 It is a structural schematic diagram of a device for determining an execution code of a deep learning model provided in an embodiment of the present application;

[0086] Fig. 9 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0087] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0088] Before explaining in detail the method for determining the execution code of the deep learning model provided in the embodiment of the present application, the relevant terms, execution entities and application scenarios provided in the embodiment of the present application are first introduced.

[0089] First, the relevant terms involved in the embodiments of the present application are briefly introduced.

[0090] Deep learning compiler: can be used to convert the source code of the deep learning model to obtain executable code that can be applied to a specific hardware platform. Furthermore, the deep learning compiler can be used to perform code optimization processing to make the output execution code of the deep learning model run more efficiently.

[0091] Intermediate code: also known as IR (Intermediate Representation), also known as intermediate expression or intermediate language, is a term widely used in the computer industry. It refers to an internal representation code that is easily converted into executable code and can be equivalent to source code.

[0092] Syntax tree: A syntax tree is a graphical representation of the code structure, which represents the operation logic of the code.

[0093] Node: A node is a point in a syntax tree that represents an operation relationship.

[0094] Cache optimization: Cache optimization is a kind of optimization made to the code, which can make data movement and data calculation parallel, so as to hide the memory access time and improve the chip utilization.

[0095] Double buffering optimization: Double buffering optimization is a way of processing code so that it can process data in parallel through two caches.

[0096] Circular cache optimization: Circular cache optimization is a way of processing the code so that it can reuse data.

[0097] DSP (Digital Signal Processing): A general-purpose chip that is often used for signal processing and image processing.

[0098] Next, the execution subject involved in the embodiments of the present application is briefly introduced.

[0099] The method for determining the execution code of the deep learning model provided in the embodiment of the present application can be executed by an electronic device, and the electronic device can be provided with a deep learning compiler, and the electronic device can implement the method for determining the execution code of the deep learning model through the deep learning compiler. As an example, the electronic device can be a laptop computer, a portable computer, a desktop computer, etc., and the embodiment of the present application does not limit this.

[0100] For ease of understanding, the following is an introduction to the general working process of a deep learning compiler. The working process of a deep learning compiler generally includes the following steps:

[0101] 1. Lexical analysis, that is, processing words composed of characters, scanning the source code character by character from left to right to generate word symbols.

[0102] 2. Syntax analysis: using word symbols as input, analyzing whether the word symbol string forms a grammatical unit that conforms to grammatical rules, such as expressions, assignments, loops, etc., and checking whether each statement has the correct logical structure according to the grammatical rules used by the language.

[0103] 3. Semantic checking and intermediate code generation. Intermediate code is an internal representation of the source code. Intermediate code can make the code structure logically simpler and clearer.

[0104] 4. Code optimization: Code optimization refers to equivalent transformation of the intermediate code so that the executable code generated by the transformed intermediate code has higher running efficiency, that is, the running time of the executable code is shorter and the storage space occupied is smaller. In the embodiment of the present application, this step is an optional step.

[0105] 5. Executable code generation: Executable code generation is the last stage of compilation, which converts the intermediate code after syntax analysis or optimization into executable code.

[0106] Then, the application scenarios involved in the embodiments of the present application are briefly introduced.

[0107] The method for determining the execution code of the deep learning model provided in the embodiment of the present application can be applied to the accelerated calculation of the deep learning model in any scenario such as target detection, target tracking, semantic segmentation, speech recognition, text recognition, natural language processing, etc.

[0108] After introducing the relevant terms and execution entities involved in the embodiments of the present application, the method for determining the execution code of the deep learning model provided in the embodiments of the present application will be described in detail with reference to the accompanying drawings.

[0109] Please refer to Figure 1 , Figure 1 It is a flowchart of a method for determining the execution code of a deep learning model provided in an embodiment of the present application. The method can be implemented by the above-mentioned execution subject, and the method may include the following implementation steps.

[0110] Step 101: Based on the data processing method of the intermediate code of the deep learning model, determine at least one pre-processing intermediate code corresponding to the intermediate code, the data processing method includes data reuse and / or data non-reuse, and the at least one pre-processing intermediate code is different from each other.

[0111] Among them, the deep learning model can be a model obtained through training in a hardware platform, the hardware platform can be ARM (Advanced RISC Machine, the first RISC (Reduced Instruction Set Computing) microprocessor), DSP, etc., and the deep learning model can be Caffe, TensorFlow, PyTorch, etc., which is not limited in this embodiment.

[0112] In this embodiment, the data processing method includes data reuse and / or data non-reuse, that is, the data processing method may include data reuse, may include data non-reuse, and may include data reuse and data non-reuse. Among them, data reuse means that when the intermediate code is actually run (or it can be understood that the executable code corresponding to the intermediate code is running), one input data may be used for multiple operations, that is, one input data will be processed multiple times. Data non-reuse means that when the intermediate code is actually run, each input data is only used for one operation, that is, each input data is only processed once.

[0113] Generally speaking, the source code of a deep learning model cannot be applied to different types of hardware platforms. Therefore, when the deep learning model needs to be run on a specific hardware platform, the source code of the deep learning model can usually be converted into an intermediate code, that is, into an internal representation code equivalent to the source code. After obtaining the intermediate code, the intermediate code can be further processed to generate a preprocessed intermediate code.

[0114] In this embodiment, at least one different pre-processing intermediate code corresponding to the intermediate code can be determined according to different data processing methods of the intermediate code. As an example, its specific implementation may include: when the intermediate code includes multiple intermediate code blocks, each intermediate code block is used to process different tensor data, the intermediate code is used as a pre-processing intermediate code. And / or, based on the data processing method of each intermediate code block, at least one of the multiple intermediate code blocks is cache optimized. The intermediate code consisting of at least one intermediate code block after cache optimization and all intermediate code blocks that have not been cache optimized is used as a pre-processing intermediate code.

[0115] That is, the intermediate code may include multiple intermediate code blocks, and the multiple intermediate code blocks can be used to perform parallel processing on multiple tensor data. Here, taking the intermediate code including multiple intermediate code blocks as an example, the process of determining at least one pre-processing intermediate code corresponding to the intermediate code is introduced.

[0116] Among them, the input data generally exists in the form of tensor data. In this embodiment, the tensor data can be considered as a three-dimensional data set. Each input data can be a row of data in the data set or a data in the data set.

[0117] In the case of different data processing methods for the intermediate code blocks, the at least one preprocessed intermediate code obtained can be divided into two categories. The first category is to not perform cache optimization processing on all intermediate code blocks in the intermediate code, that is, directly use the intermediate code as a preprocessed intermediate code. The second category is to perform cache optimization processing on some intermediate code blocks among multiple intermediate code blocks of the intermediate code, and not perform cache optimization processing on other intermediate code blocks, and use the processed intermediate code as the preprocessed intermediate code, wherein each intermediate code block can have one or more ways to perform cache optimization processing, so the second category of preprocessed intermediate codes can also have one or more corresponding ways.

[0118] Therefore, the at least one preprocessing intermediate code may include the first type of preprocessing intermediate code, and may also include any one or more of the second type of preprocessing intermediate code, and may also include any one or more of the first type of preprocessing intermediate code and the second type of preprocessing intermediate code.

[0119] For example, when the intermediate code includes two intermediate code blocks a and b, and the cache optimization processing methods are divided into 1 and 2. The intermediate code can be directly used as a preprocessed intermediate code. Perform cache optimization processing on the intermediate code block a according to cache optimization processing 1, and perform cache optimization processing on the intermediate code block b according to cache optimization processing 1, and use the processed intermediate code as a preprocessed intermediate code. Perform cache optimization processing on the intermediate code block a according to cache optimization processing 1, and perform cache optimization processing on the code block b according to cache optimization processing 2, and use the processed intermediate code as a preprocessed intermediate code. Perform cache optimization processing on the intermediate code block a according to cache optimization processing 1, do not perform cache optimization processing on the intermediate code block b, and use the intermediate code that only performs cache optimization processing on the intermediate code block a as a preprocessed intermediate code, and so on. In this way, multiple preprocessed intermediate codes of the second category can be obtained.

[0120] As an example, the cache optimization processing method may include double cache optimization processing and ring cache optimization processing. At this time, if the intermediate code includes multiple intermediate code blocks, determining at least one pre-processed intermediate code corresponding to the intermediate code may include the following specific implementation methods:

[0121] The first implementation method: Based on the data processing method of each intermediate code block, the specific implementation method of performing cache optimization processing on at least one of the multiple intermediate code blocks can be: when the data processing methods of the multiple intermediate code blocks all include non-reuse of data, performing double cache optimization processing on at least one of the multiple intermediate code blocks. Accordingly, the specific implementation method of using the intermediate code composed of at least one intermediate code block after cache optimization processing and all intermediate code blocks that have not been subjected to cache optimization processing as a preprocessed intermediate code can be: using the intermediate code composed of at least one intermediate code block after double cache optimization processing and all intermediate code blocks that have not been subjected to double cache optimization processing as a preprocessed intermediate code.

[0122] When the data processing methods of multiple intermediate code blocks are all that data is not reused, when it is necessary to perform cache optimization processing on at least one intermediate code block in the intermediate code, double cache optimization processing can be performed, and then the second type of pre-processed intermediate code block can be determined. For example, when the intermediate code includes two intermediate code blocks a and intermediate code block b, double cache optimization processing can be performed on intermediate code block a and double cache optimization processing can be performed on intermediate code block b, and the processed intermediate code is used as a second type of pre-processed intermediate code. Further, double cache optimization processing can be performed only on intermediate code block a, and then the intermediate code composed of intermediate code block a after double cache optimization processing and intermediate code block b that has not been subjected to double cache optimization processing can be used as a second type of pre-processed intermediate code. Further, double cache optimization processing can be performed only on intermediate code block b, and then the intermediate code composed of intermediate code block b after double cache optimization processing and intermediate code block a that has not been subjected to double cache optimization processing can be used as a second type of pre-processed intermediate code.

[0123] The second implementation method: Based on the data processing method of each intermediate code block, the specific implementation method of performing cache optimization processing on at least one of the multiple intermediate code blocks can be: when the data processing method of some of the intermediate code blocks in the multiple intermediate code blocks includes data reuse, and the data processing method of some of the intermediate code blocks in the multiple intermediate code blocks includes data non-reuse, double cache optimization processing is performed on at least one intermediate code block in the multiple intermediate code blocks whose data processing method includes data non-reuse, and circular cache optimization processing is performed on at least one intermediate code block in the multiple intermediate code blocks whose data processing method includes data reuse. Accordingly, the specific implementation method of using the intermediate code composed of at least one intermediate code block after cache optimization processing and all intermediate code blocks that have not been subjected to cache optimization processing as a preprocessed intermediate code can be: using the intermediate code composed of at least one intermediate code block after double cache optimization processing, at least one intermediate code block after circular cache optimization processing, and all intermediate code blocks that have not been subjected to cache optimization processing as a preprocessed intermediate code.

[0124] It can be considered that there is a first part of intermediate code blocks in the intermediate code, and the data processing mode of the first part of intermediate code blocks is that data is not reused, and the corresponding first part of intermediate code blocks can be optimized for double buffering. Similarly, it can be considered that the intermediate code blocks other than the first part of intermediate code blocks in the intermediate code are second part of intermediate code blocks, and the data processing mode of the second part of intermediate code blocks is that data is reused, and the corresponding second part of intermediate code blocks can be optimized for circular buffering.

[0125] That is to say, at least one intermediate code block in the first part of the intermediate code blocks can be subjected to double-buffer optimization processing, and at least one intermediate code block in the second part of the intermediate code blocks can be subjected to circular-buffer optimization processing, so that at least one second-class pre-processed intermediate code block can be determined. For example, when the intermediate code includes two intermediate code blocks a and intermediate code block b, the intermediate code block a can be subjected to double-buffer optimization processing and the intermediate code block b can be subjected to circular-buffer optimization processing, and the processed intermediate code can be used as a second-class pre-processed intermediate code. Further, only the intermediate code block a can be subjected to double-buffer optimization processing, and then the intermediate code composed of the intermediate code block a subjected to double-buffer optimization processing and the intermediate code block b not subjected to cache optimization processing can be used as a second-class pre-processed intermediate code. Further, only the intermediate code block b can be subjected to circular-buffer optimization processing, and then the intermediate code composed of the intermediate code block b subjected to circular-buffer optimization processing and the intermediate code block a not subjected to cache optimization processing can be used as a second-class pre-processed intermediate code.

[0126] A third implementation method: Based on the data processing methods of each intermediate code block, a specific implementation method of performing cache optimization processing on at least one of the multiple intermediate code blocks may be: when the data processing methods of the multiple intermediate code blocks all include data reuse, performing circular cache optimization processing on at least one of the multiple intermediate code blocks. Accordingly, a specific implementation method of using the intermediate code consisting of at least one intermediate code block after the cache optimization processing and all intermediate code blocks that have not been subjected to the cache optimization processing as a preprocessed intermediate code may be: using the intermediate code consisting of at least one intermediate code block after the circular cache optimization processing and all intermediate code blocks that have not been subjected to the circular cache optimization processing as a preprocessed intermediate code.

[0127] When the data processing methods of multiple intermediate code blocks are all data reuse, when it is necessary to perform cache optimization processing on at least one intermediate code block in the intermediate code, a circular cache optimization processing can be performed, and then the second type of pre-processed intermediate code block can be determined. For example, when the intermediate code includes two intermediate code blocks a and intermediate code block b, the intermediate code block a can be subjected to circular cache optimization processing and the intermediate code block b can be subjected to circular cache optimization processing, and the processed intermediate code is used as a second type of pre-processed intermediate code. Further, the circular cache optimization processing can be performed only on the intermediate code block a, and then the intermediate code composed of the intermediate code block a after the circular cache optimization processing and the intermediate code block b that has not been subjected to the circular cache optimization processing is used as a second type of pre-processed intermediate code. Further, the circular cache optimization processing can be performed only on the intermediate code block b, and then the intermediate code composed of the intermediate code block b after the circular cache optimization processing and the intermediate code block a that has not been subjected to the circular cache optimization processing is used as a second type of pre-processed intermediate code.

[0128] After introducing various methods of generating the second type of preprocessing intermediate code, the specific process of double buffer optimization processing and ring buffer optimization processing will be introduced next.

[0129] 1. The operation of performing double-buffer optimization processing on an intermediate code block in the intermediate code includes the following steps: changing part of the node information in the syntax tree so that the modified intermediate code block supports the following operations: (1) alternately caching input data into two input caches, and performing calculation processing in the input cache of the two input caches that is not currently performing the cache operation each time the data is cached. (2) recording the cache position of the first input data in the two input caches. (3) alternately caching the calculated data into two output caches, and outputting the data in the output cache of the two output caches that is not currently performing the cache operation each time the data is cached. The syntax tree is used to indicate the running logic of the intermediate code block, and each node information in the syntax tree is used to indicate an running step of the intermediate code block.

[0130] The syntax tree is generally an abstract tree structure built based on the code information for running extracted from the source code, which is used to represent the running logic of the source code. Since the intermediate code is obtained by converting the source code, the syntax tree can also be used to represent the running logic of the intermediate code. It should be noted that the running logic of different intermediate code blocks can be represented by different syntax trees, that is, in a possible implementation, one intermediate code block can correspond to one syntax tree.

[0131] Generally speaking, a syntax tree includes multiple nodes, each of which can represent an operation step, and multiple operation steps constitute the operation logic in the syntax tree. Among them, the node information can include information such as node type and node position. Changing the node information is actually modifying part of the code in the intermediate code.

[0132] That is to say, the double-buffer optimization processing of the intermediate code block, that is, changing some node information in the corresponding syntax tree, is actually to make certain modifications to some codes in the intermediate code block. Specifically, the part of the code used to implement the allocation of input buffer can be modified so that the input buffer is changed from one to two. Modify the part of the code used to implement the input loop so that the input data can be alternately input into the two input buffers, so that one input buffer is used for inputting data while the other input buffer is used for calculating data, so that the input of data and the calculation are carried out in parallel. Add some code for indicating the initial input buffer, that is, determine an input buffer in the two input buffers for caching the first input data. Modify the part of the code used to allocate the output buffer so that the output buffer is changed from one to two. Modify the part of the code used to execute the output loop so that the data can be alternately output from the two output buffers, so that one output buffer is used for outputting data while the other output buffer is used to store the data obtained after the input buffer is calculated, so that the output of data and the calculation are carried out in parallel.

[0133] For example, set the first slice input buffer mark to a, the second slice input buffer mark to b, the first slice output buffer mark to c, and the second slice output buffer mark to d. Figure 2 As shown, at T=1, the first data is input to a, at T=2, the second data is input to b, the first data is calculated in a and output to c, at T=3, the third data is input to a, the second data is calculated in b and output to d, the first data is output by c, and then a and b input data alternately, and c and d output data alternately. Figure 3 As shown, when T=N, the nth data is input to b, the n-1th data is calculated in a and output to c, and the n-2th data is output from d. When T=N+1, the nth data is calculated in b and output to d, the n-1th data is output from c, and when T=N+2, the nth data is output from d. Compared with Figure 4 , Figure 5 The double buffer optimization method with two input buffers and one output buffer is shown. It can be clearly seen that Figure 2 , Figure 3 The double buffer optimization processing method shown can achieve higher data processing efficiency.

[0134] 2. The operation of performing circular cache optimization processing on an intermediate code block in the intermediate code includes the following steps: changing part of the node information in the syntax tree so that the modified intermediate code block supports the following operations: (1) performing circular cache processing on input data. (2) alternately caching the data processed by the circular cache into two output caches, and outputting the data in the output caches of the two output caches that are not currently performing the cache operation at the same time of each caching. The syntax tree is used to indicate the operation logic of the intermediate code block, and each node information in the syntax tree is used to indicate an operation step of the intermediate code block.

[0135] Generally speaking, when the data processing mode of the intermediate code block is data reuse, the intermediate code block can be optimized for circular cache. When the input data is used in multiple running processes during the running of the intermediate code block, the intermediate code block is optimized for circular cache so that the data used by multiple running processes can be input only once, avoiding multiple inputs of data and improving data processing efficiency.

[0136] The circular buffer optimization processing of the intermediate code block, that is, changing some node information in the corresponding syntax tree, is actually to make certain modifications to some codes in the intermediate code block. Specifically, the partial code used to implement the allocation of input buffers can be modified so that there can be multiple input buffers. Modify the partial code used to execute the input loop, determine a starting input buffer, so that multiple input data can be input into multiple input buffers in sequence starting from the starting input buffer. Add partial code for indicating the input buffer of the first input data, that is, determine an input buffer among multiple input buffers to cache the first input data. Modify the partial code used to allocate the output buffer, so that the output buffer changes from one to two. Modify the partial code used to execute the output loop so that data can be output alternately from two output buffers, so that one output buffer is used to output data while the other output buffer is used to store data obtained after the input buffer is calculated, so that the output of data is carried out in parallel with the calculation.

[0137] The number of input buffers can be determined based on the number of input buffers used for calculation and the moving span of the input buffers used for calculation. Figure 6 As shown, when T=4, a, b, and c are used for calculation, that is, the number of input buffers used for calculation is 3, and when T=5, b, c, and d are used for calculation, and it can be seen that the moving span of the input buffer used for calculation is 1. Since the number of input buffers used for calculation is 3 and the moving span of the input buffer used for calculation is 1, it can be determined that the number of input buffers is 4 accordingly.

[0138] Usually the starting input buffer can be determined by the loop variable and the number of input buffers. Let the starting input buffer be index, the number of input buffers be n, and the loop variable be i. By using index = i%n, that is, taking the modulus of the loop variable and the number of input buffers, the position of the starting input buffer can be determined. For example, Figure 6 As shown, when T=1, the loop variable is 1, 1%4=1, and it can be determined that the starting input buffer is the first input buffer, that is, the first data is cached in a.

[0139] For example, the input buffer is divided into four buffers: a, b, c, and d, and the output buffer is divided into two buffers: e and f. Figure 6 As shown, when T=1, the first data is input to a, and when T=2, the second data is input to b. When T=3, the third data is input to c, and when T=4, the fourth data is input to d. a, b, and c are used for calculation, and the first data is output from a to e. When T=5, the fifth data is input to a, b, c, and d are used for calculation, and the second data is output from b to f, and the first data is output from e. After that, data is input alternately from a, b, c, and d, and data is output alternately from e and f. Figure 7 As shown, when T=N, the last data, the nth data, is input to d, a, b, and c are used for calculation, a outputs the n-3th data to e, and f outputs the n-4th data. When T=N+1, b, c, and d are used for calculation, b outputs the n-2th data to f, and f outputs the n-3th data. When T=N+2, c and d are used for calculation, c outputs the n-1th data to e, and f outputs the n-2th data. When T=N+3, d is used to calculate and output the nth data to f, e outputs the n-1th data, and when T=N+4, f outputs the nth data.

[0140] Step 102: Convert each preprocessed intermediate code into an executable code to obtain at least one executable code.

[0141] At least one preprocessing intermediate code can be converted into at least one executable code. When the same preprocessing intermediate code runs on different hardware platforms, the executable codes obtained by the conversion will also be different. Specifically, the implementation method of converting the preprocessing intermediate code into the executable code can be:

[0142] 1. Parse the copy code used to implement data input and output in the preprocessing intermediate code, determine the original address and destination address of the copy, and the input data length and other information in the copy code, and set the information as the first parameter information.

[0143] Among them, since the input data can be a row of data in the tensor data or a piece of data in the tensor data, the length of the input data is different depending on the input data.

[0144] 2. Obtain the hardware interface code of the specific hardware platform, parse the configuration file used to indicate the parameter information in the hardware interface code, determine the information in the configuration file used to indicate the destination address, original address and input data length of the copy through character matching and other methods, and set this information as the second parameter information.

[0145] Among them, the hardware interface code and configuration file of a specific hardware platform are generally determined and provided by the manufacturer, and the hardware interface code and configuration file of different hardware platforms are different.

[0146] 3. Replace the corresponding second parameter information with the first parameter information.

[0147] That is, the destination address used to indicate the copy in the configuration file is changed to the destination address parsed from the intermediate code, the source address used to indicate the copy in the configuration file is changed to the source address parsed from the intermediate code, and the input data length used to indicate the data length in the configuration file is changed to the input data length parsed from the intermediate code.

[0148] After the second parameter information of the configuration file is replaced, the replaced hardware interface code replaces the copied code in the preprocessing intermediate code, thereby obtaining an executable code that can run on a specific hardware platform.

[0149] Step 103: Determine the execution code of the deep learning model from the at least one executable code.

[0150] The at least one executable code can be run on a specific hardware platform. Generally speaking, the user will select an executable code from the at least one executable code according to actual conditions to run the deep learning model on a specific hardware platform.

[0151] The specific implementation method of determining the execution code of the deep learning model from the at least one executable code may be: determining the execution performance index of each executable code based on the tensor data to be tested. Based on the execution performance index of each executable code, determining the execution code of the deep learning model from the at least one executable code.

[0152] Generally speaking, the size of tensor data will affect the execution performance of the executable code in a specific hardware platform. For tensor data of the same size, different data in the tensor data will not affect the execution performance of the executable code in a specific hardware platform. Therefore, the size of the tensor data to be tested can be the same as the size of the tensor data to be processed by the deep learning model.

[0153] Among them, the execution performance index may include an execution time index, an execution memory index and a comprehensive index. The comprehensive index may be calculated based on the execution time index and the execution memory index.

[0154] That is, the at least one executable code is run in turn in a specific hardware platform to obtain the execution time, execution memory and comprehensive index of each executable code. By comparing the execution performance index of the at least one executable code, the executable code with the shortest execution time, the executable code with the smallest execution memory and the executable code with the highest comprehensive index are selected. Therefore, according to the actual situation, one executable code can be further selected from the above-selected executable code with the shortest execution time, the executable code with the smallest execution memory and the executable code with the highest comprehensive index to be determined as the execution code of the deep learning model.

[0155] It should be noted that there may be an executable code with the shortest execution time, the least execution memory and the highest comprehensive index, or there may be multiple executable codes with the same and shortest execution time.

[0156] For example, when the intermediate code includes two intermediate code blocks, and the data processing mode of the two intermediate code blocks is that the data is not reused. Four pre-processed intermediate codes can be obtained from the intermediate code, which can be converted into four executable codes, namely the first executable code, the second executable code, the third executable code, and the fourth executable code, which are run in turn on the specific hardware platform to determine the execution time, execution memory and comprehensive indicators of the four executable codes, so that one executable code can be determined as the execution code of the deep learning model according to actual needs.

[0157] In an embodiment of the present application, the data processing method of the intermediate code of the deep learning model may include data reuse and / or data non-reuse, and at least one different pre-processing intermediate code corresponding to the intermediate code may be determined according to different data processing methods of the intermediate code. Each pre-processing intermediate code is converted into an executable code to obtain at least one executable code, so that an execution code of a deep learning model with higher operating efficiency can be determined from the at least one executable code, avoiding the problem that the execution code of the deep learning model can only be determined according to a fixed mode.

[0158] Figure 8 1 is a schematic diagram of a structure of a device for determining an execution code of a deep learning model provided in an embodiment of the present application. The device for determining an execution code of a deep learning model can be implemented by software, hardware, or a combination of both. The device for determining an execution code of a deep learning model includes:

[0159] A first determination module 810 is used to determine at least one pre-processed intermediate code corresponding to the intermediate code based on a data processing method of the intermediate code of the deep learning model, wherein the data processing method includes data reuse and / or data non-reuse, and the at least one pre-processed intermediate code is different from each other;

[0160] A conversion module 820, configured to convert each preprocessed intermediate code into an executable code to obtain at least one executable code;

[0161] The second determination module 830 is used to determine the execution code of the deep learning model from the at least one executable code.

[0162] In a possible implementation of the present application, the device is applied to any scenario of target detection, target tracking, semantic segmentation, speech recognition, text recognition, and natural language processing.

[0163] In a possible implementation of the present application, the intermediate code includes a plurality of intermediate code blocks, each intermediate code block is used to process different tensor data, and the first determining module 810 is used to:

[0164] Using the intermediate code as a preprocessed intermediate code; and / or,

[0165] Based on the data processing mode of each intermediate code block, performing cache optimization processing on at least one intermediate code block among the multiple intermediate code blocks;

[0166] The intermediate code composed of at least one intermediate code block after the cache optimization process and all the intermediate code blocks that have not been subjected to the cache optimization process is used as a preprocessed intermediate code.

[0167] In a possible implementation of the present application, the first determining module 810 is used to:

[0168] When the data processing modes of the plurality of intermediate code blocks all include non-reuse of data, performing double-buffer optimization processing on at least one of the plurality of intermediate code blocks;

[0169] The intermediate code composed of at least one intermediate code block after the double-buffer optimization process and all intermediate code blocks not subjected to the double-buffer optimization process is used as a pre-processed intermediate code.

[0170] In a possible implementation of the present application, the first determining module 810 is used to:

[0171] When the data processing mode of some of the intermediate code blocks among the multiple intermediate code blocks includes data reuse, and the data processing mode of some of the intermediate code blocks among the multiple intermediate code blocks includes data non-reuse, performing double cache optimization processing on at least one of the multiple intermediate code blocks whose data processing mode includes data non-reuse, and performing ring cache optimization processing on at least one of the multiple intermediate code blocks whose data processing mode includes data reuse;

[0172] The intermediate code composed of at least one intermediate code block after double cache optimization processing, at least one intermediate code block after ring cache optimization processing and all intermediate code blocks not subjected to cache optimization processing is used as a preprocessed intermediate code.

[0173] In a possible implementation of the present application, the first determining module 810 is used to:

[0174] When the data processing methods of the plurality of intermediate code blocks all include data reuse, performing a ring cache optimization process on at least one of the plurality of intermediate code blocks;

[0175] The intermediate code composed of at least one intermediate code block after the ring cache optimization process and all the intermediate code blocks not subjected to the ring cache optimization process is used as a preprocessed intermediate code.

[0176] In a possible implementation of the present application, the second determining module 830 is used to:

[0177] Determine the execution performance index of each executable code based on the tensor data to be tested;

[0178] Based on the execution performance indicator of each executable code, an execution code of the deep learning model is determined from the at least one executable code.

[0179] In a possible implementation of the present application, the first determining module 810 is used to:

[0180] Change some node information in the syntax tree so that the changed intermediate code block supports the following operations:

[0181] Alternately cache input data into two input caches, and perform calculation processing using the input cache of the two input caches that is not currently performing a cache operation each time the data is cached;

[0182] Record the cache position of the first input data in the two input caches;

[0183] Alternately caching the calculated and processed data into two output caches, and outputting the data in the output caches that are not currently performing the caching operation in the two output caches during each caching operation;

[0184] The syntax tree is used to indicate the operation logic of the intermediate code block, and each node information in the syntax tree is used to indicate an operation step of the intermediate code block.

[0185] In a possible implementation of the present application, the first determining module 810 is used to:

[0186] Change some node information in the syntax tree so that the changed intermediate code block supports the following operations:

[0187] Perform circular buffering on input data;

[0188] Alternately caching the data processed by the ring buffer into two output buffers, and outputting the data in the output buffers that are not currently performing the caching operation in the two output buffers during each caching;

[0189] The syntax tree is used to indicate the operation logic of the intermediate code block, and each node information in the syntax tree is used to indicate an operation step of the intermediate code block.

[0190] In an embodiment of the present application, the data processing method of the intermediate code of the deep learning model may include data reuse and / or data non-reuse, and at least one different pre-processing intermediate code corresponding to the intermediate code may be determined according to different data processing methods of the intermediate code. Each pre-processing intermediate code is converted into an executable code to obtain at least one executable code, so that an execution code of a deep learning model with higher operating efficiency can be determined from the at least one executable code, avoiding the problem that the execution code of the deep learning model can only be determined according to a fixed mode.

[0191] It should be noted that: the device for determining the execution code of the deep learning model provided in the above embodiment only uses the division of the above functional modules as an example when determining the execution code of the deep learning model. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device for determining the execution code of the deep learning model provided in the above embodiment and the method for determining the execution code of the deep learning model belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0192] Fig. 9It is a structural diagram of an electronic device 900 provided in an embodiment of the present application. The control device 900 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 901 and one or more memories 902, wherein the memory 902 stores at least one instruction, and the at least one instruction is loaded and executed by the processor 901 to implement the method for determining the execution code of the deep learning model provided in the above-mentioned various method embodiments.

[0193] Of course, the electronic device 900 may also have components such as a wired or wireless network interface, a keyboard, and an input / output interface for input and output. The electronic device 900 may also include other components for realizing device functions, which will not be elaborated here.

[0194] The embodiment of the present application also provides a non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by the processor of the mobile terminal, the mobile terminal can execute the above Figure 1 The illustrated embodiment provides a method for determining the execution code of a deep learning model.

[0195] The present application also provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute the above Figure 1 The illustrated embodiment provides a method for determining the execution code of a deep learning model.

[0196] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0197] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.

Claims

1. A method for determining an execution code of a deep learning model, characterized in that: The method is applied to any scenario of target detection, target tracking, semantic segmentation, speech recognition, text recognition, and natural language processing. The intermediate code includes multiple intermediate code blocks, each of which is used to process different tensor data. The method includes: Using the intermediate code as a preprocessed intermediate code; and / or, Based on the data processing mode of each intermediate code block, at least one of the multiple intermediate code blocks is subjected to cache optimization processing; the intermediate code consisting of the at least one intermediate code block subjected to cache optimization processing and all the intermediate code blocks not subjected to cache optimization processing is used as a pre-processed intermediate code, wherein the data processing mode includes data reuse and / or data non-reuse, and the at least one pre-processed intermediate code is different from each other; Convert each preprocessed intermediate code into an executable code to obtain at least one executable code; Determine the execution performance index of each executable code based on the tensor data to be tested; Based on the execution performance indicator of each executable code, an execution code of the deep learning model is determined from the at least one executable code.

2. The method according to claim 1, characterized in that The step of performing cache optimization processing on at least one of the plurality of intermediate code blocks based on the data processing mode of each intermediate code block includes: When the data processing modes of the plurality of intermediate code blocks all include non-reuse of data, performing double-buffer optimization processing on at least one of the plurality of intermediate code blocks; The intermediate code consisting of at least one intermediate code block after the cache optimization process and all intermediate code blocks not subjected to the cache optimization process is used as a preprocessed intermediate code, including: The intermediate code composed of at least one intermediate code block after the double-buffer optimization process and all intermediate code blocks not subjected to the double-buffer optimization process is used as a pre-processed intermediate code.

3. The method according to claim 1, characterized in that The step of performing cache optimization processing on at least one of the plurality of intermediate code blocks based on the data processing mode of each intermediate code block includes: When the data processing mode of some of the intermediate code blocks among the multiple intermediate code blocks includes data reuse, and the data processing mode of some of the intermediate code blocks among the multiple intermediate code blocks includes data non-reuse, performing double cache optimization processing on at least one of the multiple intermediate code blocks whose data processing mode includes data non-reuse, and performing ring cache optimization processing on at least one of the multiple intermediate code blocks whose data processing mode includes data reuse; The intermediate code consisting of at least one intermediate code block after the cache optimization process and all intermediate code blocks not subjected to the cache optimization process is used as a preprocessed intermediate code, including: The intermediate code composed of at least one intermediate code block after double cache optimization processing, at least one intermediate code block after ring cache optimization processing and all intermediate code blocks not subjected to cache optimization processing is used as a preprocessed intermediate code.

4. The method according to claim 1, characterized in that The step of performing cache optimization processing on at least one of the plurality of intermediate code blocks based on the data processing mode of each intermediate code block includes: When the data processing methods of the plurality of intermediate code blocks all include data reuse, performing a ring cache optimization process on at least one of the plurality of intermediate code blocks; The intermediate code consisting of at least one intermediate code block after the cache optimization process and all intermediate code blocks not subjected to the cache optimization process is used as a preprocessed intermediate code, including: The intermediate code composed of at least one intermediate code block after the ring cache optimization process and all the intermediate code blocks not subjected to the ring cache optimization process is used as a preprocessed intermediate code.

5. The method according to claim 2 or 3, characterized in that: The operation of performing double-buffer optimization processing on an intermediate code block in the intermediate code comprises the following steps: Change some node information in the syntax tree so that the changed intermediate code block supports the following operations: Alternately cache input data into two input caches, and perform calculation processing using the input cache of the two input caches that is not currently performing a cache operation each time the data is cached; Record the cache position of the first input data in the two input caches; Alternately caching the calculated and processed data into two output caches, and outputting the data in the output caches that are not currently performing the caching operation in the two output caches during each caching operation; The syntax tree is used to indicate the operation logic of the intermediate code block, and each node information in the syntax tree is used to indicate an operation step of the intermediate code block.

6. The method according to claim 3 or 4, characterized in that The operation of performing a ring cache optimization process on an intermediate code block in the intermediate code comprises the following steps: Change some node information in the syntax tree so that the changed intermediate code block supports the following operations: Perform circular buffering on input data; Alternately cache the data processed by the ring cache into two output caches, and output the data in the output caches that are not currently performing the cache operation in the two output caches during each cache operation; The syntax tree is used to indicate the operation logic of the intermediate code block, and each node information in the syntax tree is used to indicate an operation step of the intermediate code block.

7. A device for determining an execution code of a deep learning model, characterized in that: The device is used to implement any one of the methods in claims 1-6, and the device comprises: A first determination module is used to determine at least one pre-processed intermediate code corresponding to the intermediate code based on a data processing method of the intermediate code of the deep learning model, wherein the data processing method includes data reuse and / or data non-reuse, and the at least one pre-processed intermediate code is different from each other; A conversion module, used for converting each preprocessed intermediate code into an executable code to obtain at least one executable code; The second determination module is used to determine the execution code of the deep learning model from the at least one executable code.

8. An electronic device, characterized in that: The electronic device includes a processor, a communication interface, a memory and a communication bus. The processor, the communication interface and the memory communicate with each other through the communication bus. The memory is used to store computer programs, and the processor is used to execute the programs stored in the memory to implement the steps of any method described in claims 1-6.

9. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any method described in claims 1-6 are implemented.