Graph optimization system, method and device of deep learning model, equipment and medium

Through the graph optimization system of the deep learning model, the rules import, management and matching modules are used to intelligently select optimization rules, which solves the problem of too fixed optimization strategies in the existing technology, and realizes efficient and flexible graph optimization to adapt to the diverse deep learning model needs.

CN120067560APending Publication Date: 2025-05-30太初(无锡)电子科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411912090.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

In the graph optimization of deep learning models, the optimization strategy is too fixed and lacks flexibility to adapt to all possible model structures and user personalized needs.

Method used

Provide a graph optimization system for deep learning models, including rule import module, rule management module and graph optimization module. The system achieves intelligent graph optimization by obtaining user-defined graph optimization rules, managing custom and predefined rules, and matching target rules based on the model's calculation graph characteristics and optimization target matching target rules.

Benefits of technology

It realizes intelligent selection of predefined rules and user-defined rules based on specific model structure and user needs, thereby achieving more refined and efficient graph optimization, adapting to changing deep learning models and application scenarios, and improving model training and inference efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120067560A_ABST
    Figure CN120067560A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of electronics, and discloses a graph optimization system, method, device, equipment and medium for a deep learning model.The system obtains graph optimization rules customized by a user based on optimization requirements through a rule import module, manages customized graph optimization rules and predefined graph optimization rules of all models through a rule management module, and optimizes the graph optimization rules according to the customized graph optimization rules and the predefined graph optimization rules; and matching a target graph optimization rule from a rule management module by utilizing a graph optimization module according to the computational graph characteristics of the to-be-optimized model and the optimization target, and optimizing the computational graph of the to-be-optimized model by utilizing the target graph optimization rule. According to the system provided by the invention, the predefined rule and the user-defined rule are intelligently selected according to a specific model structure and user requirements, so that finer and more efficient graph optimization is realized. Due to the flexibility and intelligence, the system can better adapt to continuously changing deep learning models and application scenes, and the training and reasoning efficiency of the models is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of electronic technologies, and particularly to a graph optimization system, method, device, equipment and medium for deep learning models. Background Art

[0002] As an important branch of artificial intelligence, deep learning has made remarkable progress in recent years. With the continuous optimization of algorithms and the improvement of computing power, deep learning models have demonstrated excellent performance in fields such as image recognition, natural language processing, and speech recognition. As one of the core components of a deep learning framework, the graph optimization engine is responsible for optimizing the computational graph of a deep learning model to improve the training and inference efficiency of the model. As the scale and complexity of deep learning models continue to increase, the performance requirements for the graph optimization engine are also getting higher and higher.

[0003] In related technologies, the methods adopted by the graph optimization engine during graph optimization mainly optimize the computational graph through a series of predefined rules. These rules include, but are not limited to, node fusion, constant folding, dead code elimination, etc. For example, the graph optimization engine of TensorFlow reduces the computational amount and memory usage through a series of optimization passes (such as graph rewriting, node merging, etc.). These optimizations are usually based on a set of predefined rules and heuristic algorithms, and can achieve good optimization effects in many cases. However, in the face of specific application scenarios, it is unable to adapt to all possible model structures and user personalized needs, and the optimization strategy is too fixed and lacks flexibility. Summary of the Invention

[0004] In view of this, the present invention provides a graph optimization system, method, device, equipment and medium for deep learning models to solve the problems of poor flexibility and limited applicable scope in optimizing the model through predefined optimization rules.

[0005] In a first aspect, the present invention provides a graph optimization system for a deep learning model, the system comprising: a rule import module, a rule management module, and a graph optimization module; the rule import module is used to obtain custom graph optimization rules for different models, and the custom graph optimization rules are obtained by the user based on optimization requirements; the rule management module is connected to the rule import module and is used to manage the custom graph optimization rules and predefined graph optimization rules for each model; the graph optimization module is connected to the rule management module and is used to match target graph optimization rules from the rule management module according to the computational graph characteristics and optimization objectives of the model to be optimized, and use the target graph optimization rules to optimize the computational graph of the model to be optimized.

[0006] The graph optimization system for deep learning models provided by the present invention obtains the graph optimization rules customized by the user based on the optimization requirements through the rule import module, manages the customized graph optimization rules and predefined graph optimization rules of each model by using the rule management module, matches the target graph optimization rules from the rule management module according to the computational graph characteristics and optimization objectives of the model to be optimized by using the graph optimization module, and optimizes the computational graph of the model to be optimized by using the target graph optimization rules. The system provided by the present invention intelligently selects predefined rules and user-defined rules according to the specific model structure and user requirements, so as to achieve more refined and efficient graph optimization. This flexibility and intelligence enable the system of the present invention to better adapt to the ever-changing deep learning models and application scenarios, and improve the training and inference efficiency of the models.

[0007] In a second aspect, the present invention provides a graph optimization method for deep learning models, which is applied to the graph optimization system for deep learning models in the first aspect. The method includes: obtaining the computational graph characteristic information and optimization objective information of the model to be optimized; matching multiple first graph optimization rules from the rule management module based on the computational graph characteristic information and optimization objective information, where the first graph optimization rules are graph optimization rules that can perform graph optimization on the model to be optimized and meet the optimization objectives; determining the target graph optimization rules based on the multiple first graph optimization rules; and using the target graph optimization rules to perform optimization processing on the computational graph of the model to be optimized to obtain an optimization result.

[0008] The graph optimization method for deep learning models provided by the present invention matches multiple first graph optimization rules from the rule management module based on the computational graph characteristic information and optimization objective information of the model to be optimized, where the first graph optimization rules are graph optimization rules that can perform graph optimization on the model to be optimized and meet the optimization objectives; determines the target graph optimization rules based on the multiple first graph optimization rules; and uses the target graph optimization rules to perform optimization processing on the computational graph of the model to be optimized to obtain an optimization result. The method provided by the present invention matches multiple first graph optimization rules from the rule management module through the computational graph characteristic information and optimization objective information of the model to be optimized, and determines the target graph optimization rules based on the multiple first graph optimization rules to optimize the computational graph of the model to be optimized, realizing intelligent selection of predefined rules and user-defined rules according to the specific model structure and user requirements, so as to achieve more refined and efficient graph optimization. It can better adapt to the ever-changing deep learning models and application scenarios, and improve the training and inference efficiency of the models.

[0009] In an optional implementation manner, the step of determining the target graph optimization rules based on the multiple first graph optimization rules includes: determining whether there is a second graph optimization rule among the multiple first graph optimization rules, where the second graph optimization rule is a user-defined graph optimization rule; if there is one second graph optimization rule among the multiple first graph optimization rules, using the second graph optimization rule as the target graph optimization rule.

[0010] In an alternative embodiment, the step of determining the target graph optimization rule based on multiple first graph optimization rules further includes: if there are at least two second graph optimization rules among the multiple first graph optimization rules, using each second graph optimization rule to optimize the computational graph of the model to be optimized, and determining the first optimization effect corresponding to the second graph optimization rule; determining the target graph optimization rule from the second graph optimization rules of multiple optimization targets based on the first optimization effect.

[0011] In an alternative embodiment, the step of determining the target graph optimization rule based on multiple first graph optimization rules includes: dynamically combining the multiple first graph optimization rules to obtain multiple third graph optimization rules; using each third graph optimization rule to optimize the computational graph of the model to be optimized, and determining the second optimization effect corresponding to the second graph optimization rule; determining the target graph optimization rule from the multiple third graph optimization rules based on the second optimization effect.

[0012] In a third aspect, the present invention provides a graph optimization device for a deep learning model, which is applied to the graph optimization system of the deep learning model in the first aspect. The device includes: an acquisition module, configured to acquire computational graph characteristic information and optimization target information of the model to be optimized; a matching module, configured to match multiple first graph optimization rules from a rule management module based on the computational graph characteristic information and the optimization target information, where the first graph optimization rule is a graph optimization rule that can perform graph optimization on the model to be optimized and meet the optimization target; a determination module, configured to determine a target graph optimization rule based on the multiple first graph optimization rules; and a processing module, configured to optimize the computational graph of the model to be optimized using the target graph optimization rule to obtain an optimization result.

[0013] In a fourth aspect, the present invention provides a computer device, including: a memory and a processor, which are communicatively connected to each other. The memory stores computer instructions, and the processor executes the computer instructions to execute the graph optimization method of the deep learning model in the first aspect or any corresponding embodiment thereof.

[0014] In a fifth aspect, the present invention provides a computer-readable storage medium, on which computer instructions are stored. The computer instructions are used to cause a computer to execute the graph optimization method of the deep learning model in the first aspect or any corresponding embodiment thereof.

[0015] In a sixth aspect, the present invention provides a computer program product, including computer instructions, which are used to cause a computer to execute the graph optimization method of the deep learning model in the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for the description of the specific embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0017] Figure 1 It is a schematic block diagram of the graph optimization system of the deep learning model according to an embodiment of the present invention;

[0018] Figure 2 It is a schematic flowchart of the graph optimization method of the deep learning model according to an embodiment of the present invention;

[0019] Figure 3 It is a schematic flowchart of another graph optimization method of the deep learning model according to an embodiment of the present invention;

[0020] Figure 4 It is a schematic flowchart of another graph optimization method of the deep learning model according to an embodiment of the present invention;

[0021] Figure 5 It is a schematic block diagram of the graph optimization device of the deep learning model according to an embodiment of the present invention;

[0022] Figure 6 It is a schematic hardware structure diagram of the computer device according to an embodiment of the present invention. Specific Embodiments

[0023] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present invention.

[0024] In the related art, the methods adopted by the graph optimization engine during graph optimization mainly optimize the computational graph through a series of predefined rules. These rules include, but are not limited to, node fusion, constant folding, dead code elimination, etc. For example, the graph optimization engine of the open-source machine learning framework (TensorFlow) reduces the computational amount and memory usage through a series of optimization passes (such as graph rewriting, node merging, etc.). The open-source deep learning framework PyTorch provides a flexible graph optimization framework that allows users to achieve specific optimizations by defining custom graph patterns. However, these methods usually rely on fixed optimization strategies and are difficult to adapt to the ever-changing model structures and user requirements. There are also similar technical solutions in the field of traditional compilers. For example, the open-source compiler (Low-Level Virtual Machine, LLVM) generates efficient machine code through a series of optimization phases (such as instruction selection, register allocation, etc.). These optimizations are usually based on a set of predefined rules and heuristic algorithms, and can achieve good optimization effects in many cases. However, when facing specific application scenarios, it cannot adapt to all possible model structures and user personalized needs, and the optimization strategy is too fixed and lacks flexibility.

[0025] In view of this, the graph optimization system for a deep learning model provided in the embodiments of the present application is applied to a graph optimization engine to implement graph optimization of a deep learning model. The system provided in the embodiments of the present application intelligently selects predefined rules and user-defined rules according to the specific model structure and user requirements, so as to achieve more refined and efficient graph optimization. This flexibility and intelligence enable the system of the present invention to better adapt to the ever-changing deep learning models and application scenarios, and improve the training and inference efficiency of the models.

[0026] In this embodiment, a graph optimization system for a deep learning model is provided. Figure 1 It is a schematic block diagram of the graph optimization system for a deep learning model according to an embodiment of the present invention. As Figure 1 shown, the system includes: a rule import module 101, a rule management module 102, and a graph optimization module 103.

[0027] The rule import module 101 is used to obtain custom graph optimization rules for different models, and the custom graph optimization rules are obtained by the user customizing based on optimization requirements.

[0028] Exemplarily, the rule import module 101 defines a high-level language that is convenient to use. The high-level language can be the Python language or support other dynamic languages. Users can define their own graph optimization rules by writing scripts in the rule definition language. The rule import module 101 includes a rule import tool: an auxiliary tool or plugin that allows users to import the written custom graph optimization rule scripts into the rule management module for subsequent use.

[0029] The rule management module 102 is connected to the rule import module 101 and is used to manage the custom graph optimization rules and predefined graph optimization rules of each model.

[0030] Exemplarily, the rule management module 102 is used to store and manage the predefined rules of different models and the user-defined graph optimization rules obtained by the rule import module 101. When the rule management module 102 manages the storage and management of the custom graph optimization rules and the predefined graph optimization rules, it will associate each custom graph optimization rule and predefined graph optimization rule with the corresponding model type, model usage, etc., to facilitate the matching of subsequent optimization rules. In the embodiment of the present application, the predefined graph optimization rules are one or more groups of optimization rules built into the deep learning graph optimization engine, and the deep learning graph optimization engine will automatically select appropriate optimization rules without the user's awareness. The user-defined rules are used when the user wants to develop customized optimization rules by themselves. The user needs to develop the optimization rules by themselves and associate them with the deep learning graph optimization engine.

[0031] The graph optimization module 103 is connected to the rule management module 102 and is used to match the target graph optimization rules from the rule management module 102 according to the computational graph characteristics and optimization objectives of the model to be optimized, and use the target graph optimization rules to optimize the computational graph of the model to be optimized.

[0032] Exemplarily, the model to be optimized may include, but is not limited to, a deep learning network model. The computational graph characteristics of the model to be optimized may include, but are not limited to, the network type of the model to be optimized (such as a CV network or an NLP network) and the network usage (such as a classification network or a detection network), etc. Based on the computational graph characteristics of the model to be optimized, one or more sets of graph optimization rules that can optimize the computational graph of the model to be optimized can be matched from the rule management module 102. Then, based on the optimization objective, the graph optimization rules that can meet the optimization objective are screened out from the matched one or more sets of graph optimization rules. Then, based on the graph optimization rules that meet the optimization objective, the target graph optimization rules are determined to optimize the computational graph of the model to be optimized. The optimization objective may include, but is not limited to, an accuracy objective, a performance objective, etc., and the most suitable rules are selected from the matched one or more sets of optimization rules according to these optimization objectives. In the embodiment of the present application, the rule management module 102 includes a rule parser, a rule selector, and a rule executor. The rule parser matches a corresponding one or more sets of optimization rules in the rule management module 102 through the name of the model to be optimized or the rule name passed in by the user. The rule selector is used to select the most suitable rules for application according to the characteristics of the computational graph and the optimization objective. The rule executor is used to execute the selected rules to optimize the computational graph.

[0033] The graph optimization system for deep learning models provided by the present invention intelligently selects predefined rules and user-defined rules according to the specific model structure and user requirements, so as to achieve more refined and efficient graph optimization. This flexibility and intelligence enable the system of the present invention to better adapt to the constantly changing deep learning models and application scenarios, and improve the training and inference efficiency of the models.

[0034] According to an embodiment of the present invention, an embodiment of a graph optimization method for a deep learning model is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.

[0035] In this embodiment, a graph optimization method for a deep learning model is provided, which can be used in the graph optimization module in the above-mentioned graph optimization system for deep learning models. Figure 2 It is a flowchart of the graph optimization method for a deep learning model according to an embodiment of the present invention, as Figure 2 shown, and the process includes the following steps:

[0036] Step S201, obtain the computational graph characteristic information and optimization objective information of the model to be optimized.

[0037] Exemplarily, the model to be optimized can be a network model that requires graph optimization. The computational graph characteristic information can include, but is not limited to, the network type and network usage of the model to be optimized. The optimization target information can include, but is not limited to, accuracy targets, performance targets, etc.

[0038] Step S202: Based on the computational graph characteristic information and the optimization target information, match multiple first graph optimization rules from the rule management module. The first graph optimization rules are graph optimization rules that can perform graph optimization on the model to be optimized and meet the optimization targets.

[0039] Exemplarily, determine at least one set of optimization rules in the rule management module that match the model to be optimized through the computational graph characteristic information, and use the rules that meet the optimization targets among the matched optimization rules as the first graph optimization rules. In the embodiments of the present application, when determining at least one set of optimization rules in the rule management module that match the model to be optimized, the matching search algorithms include, but are not limited to:

[0040] 1. Direct matching: For example, if the network name of the model to be optimized is "Resnet", search for optimization rules in the rule library that contain the "resnet" field in the name, and obtain "resnet_optimize_pass_0", "resnet_optimize_pass_1", "resnet_optimize_pass_2", etc.

[0041] 2. Distance matching: For example, if the network name is "Resnet", calculate the distance between "Resnet" and the optimization rules in the rule library, and select the several optimization rules with the closest distance, obtaining "resnet_optimize_pass_0", "resnet_optimize_pass_1", "resnet_optimize_pass_2", "yolo_optimize_pass_0", "yolo_optimize_pass_1", etc.

[0042] 3. Directly based on the specified rule name: "resnet_optimize_pass_1".

[0043] Step S203: Determine the target graph optimization rule based on the multiple first graph optimization rules.

[0044] Exemplarily, determine the target graph optimization rule from the multiple first graph optimization rules. The target graph optimization rule is the rule with the best optimization effect among the multiple first graph optimization rules.

[0045] Step S204: Use the target graph optimization rule to perform optimization processing on the computational graph of the model to be optimized, and obtain the optimization result.

[0046] Exemplarily, the calculation graph of the model to be optimized is optimized using the target graph optimization rules to obtain an optimized calculation graph.

[0047] The graph optimization method for the deep learning model provided in this embodiment matches multiple first graph optimization rules from the rule management module based on the calculation graph characteristic information and optimization target information of the model to be optimized, and determines the target graph optimization rule based on the multiple first graph optimization rules to optimize the calculation graph of the model to be optimized, realizing the intelligent selection of predefined rules and user-defined rules according to the specific model structure and user requirements, thereby achieving more refined and efficient graph optimization. It can better adapt to the ever-changing deep learning models and application scenarios and improve the training and inference efficiency of the models.

[0048] In this embodiment, a graph optimization method for a deep learning model is provided, which can be used in the graph optimization module in the above-mentioned graph optimization system for the deep learning model. Figure 3 It is a flowchart of the graph optimization method for the deep learning model according to an embodiment of the present invention. As Figure 3 shown, the process includes the following steps:

[0049] Step S301, obtain the calculation graph characteristic information and optimization target information of the model to be optimized. For details, please refer to Figure 1 Step S201 in the shown embodiment, which will not be elaborated here.

[0050] Step S302, match multiple first graph optimization rules from the rule management module based on the calculation graph characteristic information and optimization target information. The first graph optimization rule is a graph optimization rule that can optimize the model to be optimized and meet the optimization target. For details, please refer to Figure 1 Step S201 in the shown embodiment, which will not be elaborated here.

[0051] Step S303, determine the target graph optimization rule based on the multiple first graph optimization rules.

[0052] Specifically, the above step S303 includes:

[0053] Step S3031, determine whether there is a second graph optimization rule among the multiple first graph optimization rules. The second graph optimization rule is a user-defined graph optimization rule.

[0054] Exemplarily, in the embodiment of the present application, it is determined whether there is a user-defined graph optimization rule among the multiple first graph optimization rules.

[0055] Step S3032, if there is one second graph optimization rule among the multiple first graph optimization rules, use the second graph optimization rule as the target graph optimization rule.

[0056] Exemplarily, in the embodiments of the present application, the user-defined graph optimization rules are preferentially adopted. If there is only one user-defined graph optimization rule among multiple first graph optimization rules, this user-defined graph optimization rule is used as the target graph optimization rule to perform subsequent computational graph optimization operations. If there is no second graph optimization rule among multiple first graph optimization rules, based on the expected optimization effects of each first graph optimization rule and the current state of the computational graph, the matched first graph optimization rules are sorted by priority, and based on the priority sorting result, the optimal first graph optimization rule is selected.

[0057] Step S3033: If there are at least two second graph optimization rules among multiple first graph optimization rules, use each second graph optimization rule to optimize the computational graph of the model to be optimized, and determine the first optimization effect corresponding to the second graph optimization rule.

[0058] Exemplarily, in the embodiments of the present application, if there are multiple second graph optimization rules among multiple first graph optimization rules, actually compile and run the network to obtain the first optimization effects of each second graph optimization rule.

[0059] Step S3034: Determine the target graph optimization rule based on the first optimization effects in the second graph optimization rules of multiple optimization targets.

[0060] Exemplarily, in the embodiments of the present application, the second graph optimization rule with the best optimization effect is used as the target graph optimization rule.

[0061] Step S304: Use the target graph optimization rule to perform optimization processing on the computational graph of the model to be optimized to obtain the optimization result. For details, please refer to Figure 1 Step S205 of the embodiment shown, which will not be elaborated here.

[0062] In this embodiment, a graph optimization method for a deep learning model is provided, which can be used in the graph optimization module in the above-mentioned graph optimization system for the deep learning model. Figure 4 It is a flowchart of the graph optimization method for a deep learning model according to an embodiment of the present invention. As Figure 4 shown, this process includes the following steps:

[0063] Step S401: Obtain the computational graph characteristic information and optimization target information of the model to be optimized. For details, please refer to Figure 1 Step S301 of the embodiment shown, which will not be elaborated here.

[0064] Step S402: Match multiple first graph optimization rules from the rule management module based on the computational graph characteristic information and optimization target information. The first graph optimization rule is a graph optimization rule that can perform graph optimization on the model to be optimized and meet the optimization target. For details, please refer to Figure 1 Step S301 of the embodiment shown, which will not be elaborated here.

[0065] Step S403: Determine the target graph optimization rule based on multiple first graph optimization rules.

[0066] Specifically, the above-mentioned step S403 includes:

[0067] Step S4031: Dynamically combine multiple first graph optimization rules to obtain multiple third graph optimization rules.

[0068] Exemplarily, in the embodiments of the present application, if there is no second graph optimization rule among multiple first graph optimization rules, dynamically combine the multiple first graph optimization rules to obtain multiple combined third graph optimization rules. The embodiments of the present application do not limit the combination method, and those skilled in the art can determine it according to requirements.

[0069] Step S4032: Use each third graph optimization rule to optimize the computational graph of the model to be optimized, and determine the second optimization effect corresponding to the second graph optimization rule.

[0070] Exemplarily, in the embodiments of the present application, based on each dynamically combined third graph optimization rule, optimize the computational graph of the model to be optimized, and determine the expected optimization effect corresponding to the second graph optimization rule.

[0071] Step S4033: Use the second optimization effect to determine the target graph optimization rule among multiple third graph optimization rules.

[0072] Exemplarily, in the embodiments of the present application, use the third graph optimization rule with the best optimization effect as the target graph optimization rule, thereby determining the optimal rule combination.

[0073] Step S404: Use the target graph optimization rule to perform optimization processing on the computational graph of the model to be optimized to obtain an optimization result. For details, please refer to Figure 1 Step S205 in the illustrated embodiment, which will not be elaborated here.

[0074] The graph optimization method for a deep learning model provided by the present invention, based on the support of user-defined rules and predefined rules, not only improves the flexibility and adaptability of the optimization method, can better meet the needs of different users and application scenarios, but also ensures that the model has good inference performance when no specific rules are specified. By intelligently selecting and combining rules, the efficiency and effect of graph optimization are improved, thereby accelerating the inference speed of the deep learning model.

[0075] In this embodiment, a graph optimization device for a deep learning model is further provided. This device is used to implement the above-mentioned embodiments and preferred implementation manners, and those that have been described will not be repeated. As used hereinafter, the term "module" can be a combination of software and / or hardware that can achieve a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware is also possible and contemplated.

[0076] This embodiment provides a graph optimization device for a deep learning model, which is applied to the graph optimization system of the deep learning model in the above-mentioned embodiment, as Figure 5 shown. The device includes:

[0077] An acquisition module 501, configured to acquire computational graph characteristic information and optimization target information of a model to be optimized;

[0078] A matching module 502, configured to match multiple first graph optimization rules from a rule management module based on the computational graph characteristic information and the optimization target information. The first graph optimization rules are graph optimization rules that can perform graph optimization on the model to be optimized and meet the optimization target;

[0079] A determination module 503, configured to determine a target graph optimization rule based on the multiple first graph optimization rules;

[0080] A processing module 504, configured to optimize the computational graph of the model to be optimized by using the target graph optimization rule to obtain an optimization result.

[0081] In some optional implementation manners, the determination module 503 includes:

[0082] A judgment sub-module, configured to judge whether there is a second graph optimization rule among the multiple first graph optimization rules. The second graph optimization rule is a custom graph optimization rule;

[0083] A first determination sub-module, configured to, if there is one second graph optimization rule among the multiple first graph optimization rules, use the second graph optimization rule as the target graph optimization rule.

[0084] In some optional implementation manners, the determination module 503 further includes:

[0085] A judgment sub-module, configured to judge whether there is a second graph optimization rule among the multiple first graph optimization rules. The second graph optimization rule is a custom graph optimization rule;

[0086] A first determination sub-module, configured to, if there is one second graph optimization rule among the multiple first graph optimization rules, use the second graph optimization rule as the target graph optimization rule.

[0087] In some optional implementation manners, the determination module 503 further includes:

[0088] A second determination sub-module, configured to, if there are at least two second graph optimization rules among multiple first graph optimization rules, optimize the computation graph of the model to be optimized by using each second graph optimization rule, and determine a first optimization effect corresponding to the second graph optimization rule;

[0089] A third determination sub-module, configured to determine a target graph optimization rule according to the first optimization effect among the second graph optimization rules of multiple optimization objectives.

[0090] In some optional implementation manners, the determination module 503 further includes:

[0091] A combination sub-module, configured to dynamically combine multiple first graph optimization rules to obtain multiple third graph optimization rules;

[0092] A fourth determination sub-module, configured to optimize the computation graph of the model to be optimized by using each third graph optimization rule, and determine a second optimization effect corresponding to the second graph optimization rule;

[0093] A fifth determination sub-module, configured to determine a target graph optimization rule according to the second optimization effect among multiple third graph optimization rules.

[0094] The further function descriptions of the above-mentioned various modules and units are the same as those in the corresponding above embodiments, and will not be elaborated herein.

[0095] The graph optimization device of the deep learning model in this embodiment is presented in the form of functional units. Here, the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and a memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.

[0096] The embodiment of the present invention further provides a computer device, having the above Figure 5 graph optimization device of the deep learning model as shown.

[0097] Please refer to Figure 6 , Figure 6 which is a schematic structural diagram of a computer device provided by an optional embodiment of the present invention. As shown in Figure 6As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting the components, including a high-speed interface and a low-speed interface. Each component communicates with each other using different buses and can be installed on a common motherboard or installed in other ways as needed. The processor can process instructions executed within the computer device, including instructions stored in the memory or on the memory to display graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some alternative embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (such as an array of servers, a set of blade servers, or a multi-processor system). Figure 6 In the figure, a processor 10 is taken as an example.

[0098] The processor 10 can be a central processing unit, a network processor, or a combination thereof. Among them, the processor 10 can further include a hardware chip. The above hardware chip can be an application-specific integrated circuit, a programmable logic device, or a combination thereof. The above programmable logic device can be a complex programmable logic device, a field programmable gate array, a generic array logic, or any combination thereof.

[0099] Among them, the memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiments.

[0100] The memory 20 can include a program storage area and a data storage area. Among them, the program storage area can store an operating system and application programs required for at least one function; the data storage area can store data created according to the use of the computer device and the like. In addition, the memory 20 can include a high-speed random access memory, and can also include a non-transitory memory, such as at least one disk storage device, a flash memory device, or other non-transitory solid-state storage devices. In some alternative embodiments, the memory 20 can optionally include a memory remotely set relative to the processor 10, and these remote memories can be connected to the computer device through a network. Examples of the above network include but are not limited to the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.

[0101] The memory 20 can include a volatile memory, such as a random access memory; the memory can also include a non-volatile memory, such as a flash memory, a hard disk, or a solid-state drive; the memory 20 can also include a combination of the above types of memories.

[0102] The computer device further includes a communication interface 30 for the computer device to communicate with other devices or communication networks.

[0103] Embodiments of the present invention also provide a computer-readable storage medium. The method according to the embodiments of the present invention can be implemented in hardware, firmware, or be implemented as computer code that can be recorded on a storage medium, or be implemented as computer code that is originally stored in a remote storage medium or a non-transitory machine-readable storage medium and downloaded through a network and will be stored in a local storage medium, so that the method described herein can be stored as such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only memory, a random access memory, a flash memory, a hard disk, or a solid-state drive, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code, and when the software or computer code is accessed and executed by the computer, the processor, or the hardware, the method shown in the above embodiments is implemented.

[0104] A part of the present invention can be applied as a computer program product, such as computer program instructions, which when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should be able to understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Herein, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to the computer.

[0105] Although the embodiments of the present invention are described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations all fall within the scope defined by the appended claims.

Claims

1. A graph optimization system for a deep learning model, characterized in that: The system includes: a rule import module, a rule management module and a graph optimization module; The rule import module is used to obtain custom graph optimization rules for different models, where the custom graph optimization rules are customized by the user based on optimization requirements; The rule management module is connected to the rule import module and is used to manage the custom graph optimization rules and predefined graph optimization rules of each model; The graph optimization module is connected to the rule management module, and is used to match target graph optimization rules from the rule management module according to the calculation graph characteristics of the model to be optimized and the optimization target, and optimize the calculation graph of the model to be optimized using the target graph optimization rules.

2. A graph optimization method for a deep learning model, characterized in that: A graph optimization system applied to the deep learning model of claim 1, wherein the method comprises: Obtain the computational graph characteristic information and optimization target information of the model to be optimized; Based on the computation graph characteristic information and the optimization target information, a plurality of first graph optimization rules are matched from a rule management module, where the first graph optimization rules are graph optimization rules that can perform graph optimization on the model to be optimized and meet the optimization target; Determining a target graph optimization rule based on the plurality of first graph optimization rules; The target graph optimization rule is used to optimize the calculation graph of the model to be optimized to obtain an optimization result.

3. The method according to claim 2, characterized in that The step of determining a target graph optimization rule based on the plurality of first graph optimization rules comprises: Determine whether there is a second graph optimization rule among the multiple first graph optimization rules, where the second graph optimization rule is a custom graph optimization rule; If there is a second graph optimization rule among the multiple first graph optimization rules, the second graph optimization rule is used as the target graph optimization rule.

4. The method according to claim 3, characterized in that The step of determining a target graph optimization rule based on the plurality of first graph optimization rules further includes: If there are at least two second graph optimization rules among the plurality of first graph optimization rules, optimizing the computation graph of the to-be-optimized model using each second graph optimization rule, and determining a first optimization effect corresponding to the second graph optimization rule; The first optimization effect determines a target graph optimization rule in a second graph optimization rule of multiple optimization targets.

5. The method according to claim 2, characterized in that: The step of determining a target graph optimization rule based on the plurality of first graph optimization rules comprises: Dynamically combining the multiple first graph optimization rules to obtain multiple third graph optimization rules; Optimize the calculation graph of the model to be optimized by using each third graph optimization rule to determine a second optimization effect corresponding to the second graph optimization rule; The target graph optimization rule is determined from a plurality of third graph optimization rules using the second optimization effect.

6. A graph optimization device for a deep learning model, characterized in that: A graph optimization system applied to the deep learning model of claim 1, wherein the device comprises: The acquisition module is used to obtain the calculation graph characteristic information and optimization target information of the model to be optimized; A matching module, configured to obtain a plurality of first graph optimization rules from a rule management module by matching based on the computation graph characteristic information and the optimization target information, wherein the first graph optimization rules are graph optimization rules that can perform graph optimization on the model to be optimized and meet the optimization target; A determination module, configured to determine a target graph optimization rule based on the plurality of first graph optimization rules; The processing module is used to optimize the calculation graph of the model to be optimized by using the target graph optimization rule to obtain an optimization result.

7. The device according to claim 6, characterized in that The determining module comprises: A judgment submodule, used to judge whether there is a second graph optimization rule among the plurality of first graph optimization rules, wherein the second graph optimization rule is a custom graph optimization rule; The first determination submodule is configured to use, if there is a second graph optimization rule among the plurality of first graph optimization rules, the second graph optimization rule as a target graph optimization rule.

8. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the graph optimization method for the deep learning model described in any one of claims 2 to 5 by executing the computer instructions.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the graph optimization method for the deep learning model described in any one of claims 2 to 5.

10. A computer program product, characterized in that It includes computer instructions, which are used to cause a computer to execute the graph optimization method of the deep learning model described in any one of claims 2 to 5.