DEEP LEARNING FRAMEWORK OPERATOR PROCESSING METHOD AND APPARATUS, ELECTRONIC DEVICE, STORAGE MEDIUM, AND COMPUTER PROGRAM

The method addresses inefficiencies in deep learning frameworks by converting flexible functions into unified operators with device-independent kernels, enhancing extensibility and performance through a functional operator system.

JP7549153B2Active Publication Date: 2024-09-10BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
JP2023549884
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Priority Date
2022-05-19
Filing Date
2022-11-02
Publication Date
2024-09-10
Estimated Expiration
2042-11-02

AI Technical Summary

Technical Problem

Existing deep learning frameworks face challenges in efficiently supporting extensibility, maintenance, and performance due to trade-offs in operator multiplexing and design paradigms, leading to increased costs and scheduling overheads.

Method used

A method and apparatus for processing deep learning framework operators by parsing template parameters to obtain complete parameters independent of the framework, allowing for high-performance multiplexing without scheduling overheads, using a functional operator system with device-independent kernels.

Benefits of technology

Enables efficient operator multiplexing with reduced maintenance costs and improved performance by converting flexible functions into unified, descriptive operators, facilitating seamless integration and expansion within deep learning frameworks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007549153000014
    Figure 0007549153000014
  • Figure 0007549153000011
    Figure 0007549153000011
  • Figure 0007549153000012
    Figure 0007549153000012
Patent Text Reader

Abstract

The present disclosure provides an operator processing method for a deep learning framework, and relates to the field of computer technology, in particular to the field of artificial intelligence technology such as deep learning. A specific implementation is to obtain a processed operator including an operator kernel function and a template parameter independent of the deep learning framework, and in response to receiving input information for the processed operator, analyze the template parameter using the input information to obtain a plurality of complete template parameters dependent on the deep learning framework, and process the operator kernel function according to the plurality of complete template parameters to obtain an available operator for the deep learning framework. The present disclosure relates to an operator processing device for a deep learning framework, an electronic device , written storage medium and computer programs Further provide.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] This application claims priority from Chinese Patent Application No. 202210560831.9 filed on May 19, 2022, the contents of which are incorporated herein by reference.

[0002] <Technical field> The present disclosure relates to the field of computer technology, and in particular to the field of artificial intelligence technology such as deep learning. More specifically, the present disclosure relates to an operator processing method, device, and electronic device in a deep learning framework. vessel, storage medium and computer programs to provide. [Background technology]

[0003] With the development of artificial intelligence technology, deep learning frameworks have attracted more and more attention. Evaluation indicators of deep learning frameworks include the scalability of the framework. Summary of the Invention [Means for solving the problem]

[0004] The present disclosure relates to a method and apparatus for processing operators in a deep learning framework, electronic machine vessel, storage medium and computer programs to provide.

[0005] According to one aspect of the present disclosure, a method for processing operators in a deep learning framework is provided, the method including: obtaining a processed operator including an operator kernel function and deep learning framework-independent template parameters; in response to receiving input information for the processed operator, parsing the template parameters using the input information to obtain a plurality of complete template parameters that are deep learning framework-dependent; and processing the operator kernel function based on the plurality of complete template parameters to obtain an available operator for the deep learning framework.

[0006] According to another aspect of the present disclosure, there is provided an operator processing apparatus for a deep learning framework, the apparatus including: an acquisition module for acquiring a processed operator including an operator kernel function and deep learning framework-independent template parameters; an analysis module for, in response to receiving input information for the processed operator, analyzing the template parameters using the input information to obtain a plurality of complete template parameters that are deep learning framework-dependent; and a processing module for processing the operator kernel function based on the plurality of complete template parameters to obtain an available operator for the deep learning framework.

[0007] According to another aspect of the present disclosure, there is provided an electronic device including at least one processor and a memory communicatively connected to the at least one processor, wherein commands that can be executed by the at least one processor are stored in the memory, and the execution of the commands by the at least one processor enables the at least one processor to perform the method provided by the present disclosure.

[0008] According to another aspect of the present disclosure, there is provided a non-transitory computer readable storage medium having stored thereon computer instructions for causing a computer to perform the methods provided by the present disclosure.

[0009] According to another aspect of the present disclosure, there is provided a computer program product which, when executed by a processor, implements the methods provided by the present disclosure. M Provided.

[0010] It should be understood that the contents described in this section are not intended to depict key points or important features of the embodiments of the present disclosure, and are not intended to limit the scope of the present disclosure. Other features of the present disclosure will be readily understood from the following description.

[0011] Here, the drawings are used for a better understanding of the present technical solution, and are not intended to limit the present disclosure. [Brief description of the drawings]

[0012] [Figure 1] 1 is a flowchart of an operator processing method of a deep learning framework according to an embodiment of the present disclosure.

[0013] [Diagram 2] 1 is a flowchart of an operator processing method of a deep learning framework according to an embodiment of the present disclosure.

[0014] [Diagram 3] 1 is a flowchart of an operator processing method of a deep learning framework according to an embodiment of the present disclosure.

[0015] [Figure 4] 1 is a flowchart of an operator processing method of a deep learning framework according to an embodiment of the present disclosure.

[0016] [Diagram 5] 1 is a flowchart of an operator processing method of a deep learning framework according to an embodiment of the present disclosure.

[0017] [Figure 6] FIG. 2 is an exemplary schematic diagram of a global operator table according to an embodiment of the present disclosure.

[0018] [Figure 7] FIG. 2 is a block diagram of an operator processing unit of a deep learning framework according to one embodiment of the present disclosure.

[0019] [Figure 8] FIG. 1 is a block diagram of an electronic device to which an operator processing method of a deep learning framework according to an embodiment of the present disclosure can be applied. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0020] Hereinafter, exemplary embodiments of the present disclosure will be described with reference to the drawings. Hereinafter, various details of the embodiments of the present disclosure are included for easier understanding, and they should be considered as examples. Therefore, it should be understood that a person skilled in the art can make various changes and modifications to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for clarity and conciseness, the following description omits descriptions of well-known functions and configurations.

[0021] Deep learning frameworks, as infrastructure in the field of artificial intelligence, have entered a more mature stage of development. Whether they can more efficiently and conveniently support upper-level extension and secondary development is an important indicator for assessing whether a deep learning framework product can function as an "infrastructure", whether it can realize the landing of the artificial intelligence industry, and whether it can carry out field expansion.

[0022] Deep learning frameworks include the PaddlePaddle framework, the PyTorch framework, the TensorFlow framework, the MindSpore framework, and several other niche frameworks. These frameworks can provide similar functions. However, as the "cornerstone" of the construction of the ecosystem in the era of artificial intelligence, deep learning frameworks need to attract more upstream developers so that the frameworks can be further processed and modified. Therefore, deep learning frameworks need to have characteristics such as clear design, easy maintenance, easy understanding, and easy customization and extension development, so as to reduce the cost of upstream developers co-constructing the framework ecosystem. The operator system can account for more than half of the code in a framework and can be the main body of a deep learning framework. Whether the operator system can be extended and added at low cost is an important part of reducing the cost of co-constructing the framework ecosystem.

[0023] An operator is a tensor calculation unit in a deep learning framework. An operator can take a specific tensor combination as input, complete a specific calculation logic, and return a calculation result. The process of building a model using a deep learning framework can be a process of combining different operators to fulfill a specific calculation logic.

[0024] The diversity and richness of operators can be an important indicator for evaluating a deep learning framework. Operators in a deep learning framework may be continuously and dynamically added. There are relationships and distinctions between different operators. Complex operators are often implemented by combining simple operators. If a deep learning framework supports such a mode of implementation by combining operators, it will contribute to reducing costs and increasing efficiency, and also attract external developers to secondary development of the framework.

[0025] Functions are a fundamental paradigm in programming languages. Functions may be called by each other. In order to provide a deep learning framework with convenient operator combinatorial development capabilities, the deep learning framework can be built based on the functional operator system.

[0026] There are few applications of the functional operator system. There is a contradiction between functions and operators. For example, the function itself is too simple and does not have the ability to carry information and features. In addition, the function is too flexible, has diverse forms, diverse parameters, and is difficult to normalize. The operator is a relatively complex concept, has a feature description, and needs to be adapted to various devices. In addition, the operator, as an integrated scheduling unit of the framework, needs to abstract a matching form to fit the global scheduling.

[0027] From a practical perspective, deep learning framework products often make trade-off designs, abandoning the functional paradigm and using the "structure + internal calculation method" format, sacrificing the convenience of combination multiplexing to maintain the unity of the operator paradigm. However, such trade-off designs lead to increased frame maintenance costs and expansion costs.

[0028] Some deep learning framework products can encapsulate top-level operator functions to shield the diversity of operators. These deep learning framework products can realize multiplexing between operators by using a method of performing distribution selection inside the function. When multiplexing between operators, these deep learning framework products incur the scheduling overhead of distribution selection, which impairs performance. These deep learning framework products retain the convenience of operator combination multiplexing, but sacrifice some performance. Performance can be improved without operator combination, and the operator multiplexing method can be abandoned and the code of multiple operator kernels can be directly combined to improve performance.

[0029] Therefore, if the problem of multiplexing performance between functional operators is resolved, the superiority of functional operators can be permanently demonstrated.

[0030] In order to form an operator system that combines "function expressions" and "high-performance multiplexing", it is necessary to automatically package "functions" that are simple in form, flexible and diverse as operators with unified form and descriptive characteristics, and realize the development of "function expressions", thereby ensuring that no additional scheduling and distribution overhead is introduced when multiplexing function expression operators, and realizing "high-performance multiplexing".

[0031] To implement the functional operator system, it is necessary to design a paradigm for functional operators and analyze and register functional operators. The paradigm design for functional operators is to implement the computation kernel of an operator by writing functions. In functions, the C++ programming language is generally used to create the core computation logic of the operator. Functional operators naturally support mutual multiplexing among operators. The analysis and registration of functional operators designs a key component to automatically package simple, flexible and diverse functions into operators with unified formats and description characteristics, and provide them for the unified scheduling of the framework.

[0032] In addition, to implement a multiplexable functional operator system, functional operators must support device-independent multiplexing. When the same operator is applied to different devices, different kernel functions are required. For example, when an operator is applied to a CPU (Central Processing Unit), a CPU operator kernel is required, and when a GPU (Graphics Processing Unit) is applied, a GPU operator kernel is required. Even if it is a functional operator, these two kernels must be different functions. When an operator is newly developed and can be implemented by multiplexing and combining other operators, the multiplexed operator must be device-independent, otherwise it will lead to duplicate development. Here is a simple example.

[0033] Assume two operators already exist.

[0034] - Operator A: - Operator A CPU kernel: A_CPU() - Operator A GPU kernel: A_GPU()

[0035] - Operator B: - Operator B CPU kernel: B_CPU() - Operator B GPU kernel: B_GPU()

[0036] For example, implement one new operator based on operator A and operator B.

[0037] One implementation method is as follows:

[0038] - Operator C (implemented by multiplexing operators A and B): - Operator C CPU kernel: C_CPU(){ A_CPU(); B_CPU();} - Operator C GPU kernel: C_GPU(){ A_GPU(); B_GPU();}

[0039] This implementation method is not a rational functional operator system, has a lot of redundant code, and has high maintenance costs. In addition, the multiplexed operator according to this method can only be multiplexed by device, and it is easy to find that the implementation code of the operator C kernel of each device is almost the same. The functional operator system is intended to improve the multiplexing efficiency of the operator, reduce maintenance costs, and facilitate extended development. Each device kernel in this way needs to be implemented by almost copying one kernel, and is not a strict functional operator system.

[0040] As mentioned above, different deep learning frameworks may include, for example, the Pytorch framework, the TensorFlow framework, and the MindSpore framework.

[0041] In the Pytorch framework, operators are ultimately encapsulated into a single function-expression interface, and function-expression operators may be multiplexed with each other. A single operator in Pytorch is implemented in multiple layers, and when an upper layer calls a lower layer, it is necessary to search for and implement the operator in the next layer. In the PyTorch framework, when multiplexing between operators and multiplexing within an operator, a method is adopted to search and select the corresponding kernel using an operator kernel mapping table. The overhead of this method is relatively large, and multiple operator searches may be required during the execution process of one operator.

[0042] In the TensorFlow framework, operators are still structure operators, not function expression operators. Implementing a structure-based operator kernel is not intuitive, it adds additional concepts, and multiplexing operators requires more complex notation and larger scheduling overhead, making the design naturally inconvenient for developing new operator combinations.

[0043] Generally, in a structure-based operator system, when implementing an operator kernel function, it is necessary to define a function separately so that different operators can multiplex the operator kernel function. Although this method can achieve a certain degree of generalization, it has high maintenance costs and is difficult to manage in a normative manner. With the long-term development of the framework, a lot of redundant code will appear, and the maintenance costs will gradually increase.

[0044] In the tensorflow / runtime framework, a derivative of the TensorFlow framework, operators can be functional operators. However, the tensorflow / runtime framework is only an experimental product, with a small number of operators that are not yet systematic. In addition, the operator parameter list is confusing and not very standard, making it difficult to achieve high-performance multiplexing.

[0045] The operators in the MindSpore framework are similar to those in the TensorFlow framework and will not be repeated here.

[0046] FIG. 1 is a flowchart of an operator processing method of a deep learning framework according to one embodiment of the present disclosure.

[0047] As shown in FIG. 1, the method 100 may include operations S110 to S130.

[0048] In operation S110, the operator to be processed is acquired.

[0049] For example, the operators to be processed include operator kernel functions and deep learning framework independent template parameters.

[0050] For example, the acquired operator to be processed may be, for example, a Scale operator. The Scale operator may include an operator kernel function scale_kernel (scaling operator kernel function) and a template parameter T. The scale_kernel can perform a scale operation.

[0051] For example, template parameters that are independent of the deep learning framework may include template parameters that are independent of the implementation device of the deep learning framework, and may include template parameters that are independent of the data type of the deep learning framework.

[0052] For example, the implementation device may be a CPU or a GPU, and the data type may be a Float (floating point) type or an Int (integer) type.

[0053] For example, if the Scale operator is the processing target operator, the processing target operator is, for example, ScaleKernel<T、 Context> () can be expressed as:

[0054] In operation S120, in response to receiving input information for the operator to be processed, the input information is used to analyze template parameters to obtain a plurality of complete template parameters dependent on a deep learning framework.

[0055] For example, one complete template parameter is:<Float、 CPUContext> Float is the data type and CPUContext is the device type.

[0056] In operation S130, the operator kernel function is processed based on the plurality of complete template parameters to obtain an available operator for the deep learning framework.

[0057] For example, after obtaining the operator to be processed, available operators of a specific deep learning framework are obtained through analysis, and the available operators are registered in the deep learning framework so that other routines or tasks in the deep learning framework can call the available operators according to actual deep learning applications to perform corresponding algorithms or functions, such as scaling, convolution, etc.

[0058] For example, the complete template parameter<Float、 CPUContext> Based on the operator kernel function scale_kernel, available operators can be obtained. Available operators are, for example, ScaleKernel<Float、 CPUContext> () can be expressed as:

[0059] According to the embodiments of the present disclosure, when operators are multiplexed, no scheduling overhead is realized, and high performance multiplexing can be realized.

[0060] In some embodiments, the method 100 may further include invoking the available operator in response to a call command for the available operator and compiling the invoked available operator to perform a function corresponding to the available operator.

[0061] For example, the available operator ScaleKernel<float、 CPUContext> In response to a call command to ScaleKernel(), the available operators<float、 CPUContext> Call () and use the available operators ScaleKernel<float、 CPUContext> By compiling (), the functionality of the scale function is executed.

[0062] In some embodiments, a declaration of an implementation-independent operator kernel function of a deep learning framework may be, for example, as follows:

[0063]

number

[0064] Template is a template. typename T is a template parameter that is independent of the data type of the deep learning framework. typename Context is a template parameter that is independent of the implementation device of the deep learning framework. typename T and typename Context do not need to be bound to a concrete implementation device.

[0065] Also, for example, an operator Calc capable of multiplexing a basic operation may be, for example, as follows:

[0066]

number

[0067] The operator Calc called the operator ScaleKernel<T、 Context> (). Operator ScaleKernel<T、 Context> The () is an implementation-independent operator. At compile time, it takes template parameters T and Context and converts them into a concrete data type and implementation device by the compiler. In one example, the operator ScaleKernel<T、 Context> () is ScaleKernel<float、 CPUContext> At run time, the operator Calc calls the float type of the scale operation, and makes decisions and selections based on the command set of the CPU device without requiring any other logic, enabling multiplexing without scheduling overhead and realizing high performance multiplexing.

[0068] In some embodiments, in response to receiving input information for the operator to be processed, parsing the template parameters using the input information to obtain a plurality of complete template parameters dependent on the deep learning framework includes creating a variable parameter list using a macro and iteratively parsing the template parameters based on the variable parameter list, where the input information is a macro parameter of the macro.

[0069] For example, a macro is a mechanism in the C language that is used to simplify duplicated code. During pre-compilation, the macro is replaced with the corresponding code segment and executed.

[0070] For example, the above-mentioned processing operator ScaleKernel<T、 Context> Based on the input information to (), a variable parameter list may be identified. A macro iteratively parses based on the variable parameter list. In one example, the macro PD_REGISTER_KERNEL can parse the variable parameter list.

[0071]

number

[0072] In some embodiments, the variable parameter list includes a name of the operator to be processed, a name of the operator kernel function, a data layout of the operator kernel function, an equipment type for implementing the deep learning framework, and a data type for implementing the deep learning framework.

[0073] For example, in the parameter list created using the macro for the Scale operator mentioned above, scale is the operator name, CPU is the device type for implementing the deep learning framework, ALL_LAYOUT indicates that the operator kernel function ScaleKernel can be adapted to all data layouts, ScaleKernel represents the name of the operator kernel function to be registered and analyzed, and float, double, bfloat16, uint8_t, int16_t, int, and int64_t represent data types supported by the deep learning framework.

[0074] In some embodiments, iteratively analyzing the template parameters based on the variable parameter list includes determining a number of parameters included in the macro, determining an iteration end position based on the number of parameters, and iteratively processing the input information using the variable parameter list based on the iteration end position.

[0075] For example, the above-mentioned processing operator ScaleKernel<T、 Context> When the macro PD_REGISTER_KERNEL is used to parse the parameter list for (), another macro PD_NARGS may be used to specify the number of parameters contained in the macro PD_REGISTER_KERNEL.

[0076] Also, for example, after the number of parameters is specified, the number of parameters can be used as a subscript for the macro to splice a lower layer macro method, and then the macro method can be called and analyzed.

[0077] For example, the macro PD_NARGS may be, for example:

[0078]

number

[0079] For example, for PD_NARGS(...), "..." may be the variable parameter list described above. According to an embodiment of the present disclosure, it is possible to identify how many parameters exist in a macro, and identify the repetition end position by iteratively analyzing the macro parameters from the position of the corresponding number of parameters.

[0080] In other embodiments, the macro PD_NARGS may be nested outside the variable parameter macro _VA_ARGS to perform related processing.

[0081] For example, the macro PD_NARGS can be nested outside the variable parameter macro VA_ARGS in the following way:

[0082]

number

[0083] After the iteration end location is identified, the template parameters can be iteratively parsed based on the variable parameter list.

[0084] In some embodiments, iteratively parsing the template parameters based on the variable parameter list may further include iteratively parsing the template parameters based on the input information using the variable parameter list to obtain a plurality of internal template parameters, and splicing the plurality of internal template parameters to obtain a plurality of complete template parameters, as will be described in detail below with reference to FIG.

[0085] FIG. 2 is a flowchart of an operator processing method of a deep learning framework according to another embodiment of the present disclosure.

[0086] 2, the method 221 iteratively analyzes the template parameters based on the variable parameter list, which will be described in detail below with reference to operations S2211 and S2212.

[0087] In operation S2211, the template parameters are iteratively parsed using the variable parameter list to obtain a number of internal template parameters.

[0088] For example, the macro VA_ARGS can be used to iterate through the macro parameters to iteratively parse the template parameters based on a variable parameter list.

[0089] For example, a variable parameter list can be used to obtain template parameters by iteratively parsing in the following manner:

[0090]

number

[0091] For the macro PD_KERNEL_REGISTRAR_INIT_4, the macro parameters "..." are the variable parameter list described above. In one example, the macro parameters include, for example, float, double, bfloat16, uint8_t, int8_t, int16_t, int, and int64_t.

[0092] Inside the macro PD_KERNEL_REGISTRAR_INIT_4, the macro PD_KERNEL_REGISTRAR_INIT_3 can be called.

[0093] The macro PD_KERNEL_REGISTRAR_INIT_3 is used to nest outside the macro VA_ARGS to iterate over the variable parameter list as a whole. The macro PD_KERNEL_REGISTRAR_INIT_3 parses the first parameter in the variable parameter list, which may be a float, for example. In this case, cpp_dtype may be a float, and the macro parameters "..." of the macro PD_KERNEL_REGISTRAR_INIT_4 may include double, bfloat16, uint8_t, int8_t, int16_t, int, and int64_t. On the next iteration, the double becomes the first parameter in the variable parameter list.

[0094] In operation S2212, the multiple inner template parameters are spliced ​​to obtain multiple complete template parameters.

[0095] In an embodiment of the present disclosure, the internal template parameters include strings.

[0096] In an embodiment of the present disclosure, splicing a plurality of internal template parameters to obtain a plurality of complete template parameters includes splicing a plurality of strings to obtain a plurality of complete template parameters for the processed operator based on the input information.

[0097] For example, the parsed internal template parameter is a string. The strings include, for example, the string Float and the string CPUContext. The two strings are spliced ​​together to produce the complete template parameter:<Float、 CPUContext> can be obtained.

[0098] In some embodiments, processing the operator kernel function based on the plurality of complete template parameters to obtain available operators for the deep learning framework includes: for each complete template parameter among the plurality of complete template parameters, identifying a function parameter type of the complete template parameter, converting input information of the complete template parameter into corresponding parameter information based on the function parameter type, and recording the corresponding parameter information, which will be described in detail below with reference to FIG.

[0099] FIG. 3 is a flowchart of an operator processing method of a deep learning framework according to one embodiment of the present disclosure.

[0100] 3, the method 330 converts input information of complete template parameters into corresponding parameter information by, for example, traversing I complete template parameters and performing operations including operations S331 to S335 on the i-th complete template parameter, where I is an integer equal to or greater than 1 and i is an integer equal to or less than I.

[0101] In operation S331, the function parameter types of the i-th complete template parameters are identified.

[0102] For example, some function parameter types can be identified as function parameter types based on the i-th complete template parameters.

[0103] In operation S332, the input information of the i-th complete template parameters is converted into the i-th set of parameter information based on the function parameter type.

[0104] For example, different function parameter types may correspond to different conversion methods, and the correspondence between the function parameter types and the conversion methods may be preset.

[0105] Also for example, the input information for the above-mentioned target operator may include an i-th input information corresponding to an i-th complete template parameter. The i-th input information may include a number of function parameters. Based on the corresponding function parameter types, the input information may be converted into a corresponding i-th set of parameter information.

[0106] In operation S333, the i-th set of parameter information is recorded.

[0107] For example, the i-th set of parameter information may be recorded in memory.

[0108] In operation S334, it is determined whether i is equal to I.

[0109] If i=I, perform operation S335 and end the flow. If i=I, then I complete template parameters have already been traversed and the flow can end.

[0110] If i is smaller than I, the process returns to operation S331, and operations S331 to S334 are executed on the (i+1)th complete template parameters.

[0111] In one example, when there are eight data types and two device types, 16 sets of parameter information can be obtained through the iterative traversal method, and different combinations of device types and data types can be supported.

[0112] In one example, for the input information of the above-mentioned i-th function, the function parameter type of the i-th function can be identified, and the type and related necessary information are recorded. For example, by using C++ template metaprogramming technology, functions such as calculation, determination, conversion, inquiry, etc. during compilation can be realized.

[0113] In some embodiments, for example, the method 300 described above may further include creating a registered operator based on the deep learning framework based on the plurality of complete template parameters, and registering the registered operator in a global operator table within the deep learning framework.

[0114] In order to realize integrated scheduling within a deep learning framework, the function writing style corresponding to the operators within the deep learning framework may be normalized, and the normalized writing style is significantly different from the method of creating the computation function of the user's customized operator.

[0115] For example, in different scenes, different users may write their calculation functions differently. For example, when one tensor is input, the function is written as follows:

[0116] return Tensor List Operator Compute Function Name (Input Tensor1) { ...}.

[0117] On the other hand, if you have two input tensors, you can write the function as follows:

[0118] Return Tensor list operator computation function name (input Tensor1, input Tensor2) { ...}.

[0119] If there are more inputs, there are also more function declarations. In the C++ programming language, different function declarations mean different function pointer types, i.e., different data types, and the framework needs to remember the function pointer types that users can create and call at the lowest level of the framework. This extremely flexible paradigm of writing cannot be remembered in a concise and generic form in the C++ programming language. In order to achieve overall conciseness, it is also necessary to normalize the various calculation functions created by users.

[0120] For example, the function format of one customized calculation function is as follows:

[0121] return Tensor List Operator Compute Function Name (Input Tensor1) { ...}.

[0122] Another customized calculation function has the following function format:

[0123] Returns Tensor list operator computation function name (input Tensor1, input Tensor2) { ...}.

[0124] The functional formats of the above two customized computation functions are not unified, and in this embodiment, in order to facilitate integrated scheduling within the deep learning framework, the different customized computation functions need to be normalized.

[0125] In an embodiment of the present disclosure, the registered operator includes registered operator description information and a registered operator kernel function, the registered operator kernel function includes normalized input information and a normalized function pointer, and creating a registered operator based on a deep learning framework based on a plurality of complete internal template functions includes, for each complete template parameter of the plurality of complete template parameters, identifying a structure including a static function having a normalized form corresponding to the complete template parameter, rendering the input information of the static function the normalized input information, and rendering the function pointer of the static function the normalized function pointer.

[0126] For example, various operators in a deep learning framework can be implemented by inheriting the OpKernel class and filling in their own computation function (Compute). The corresponding input and output tensors of the operator may be stored in the execution context (ExecutionContext) and can be obtained by the Input and Output functions of the execution context. In one example, when constructing a kernel function of an operator to be registered, it can be constructed based on a normalized form of the function, and the normalized function may be a static function in a structure corresponding to the complete template parameters.

[0127] For example, when constructing an operator kernel function to be registered, it includes creating input information for the static function, creating a function pointer for the static function, and creating other standard processes, such as a process for obtaining input information from the context and putting it into the inputs variable.

[0128] By adopting a unified form of static function when constructing the registered target operator kernel function, the customized computation function can be unified for the integrated scheduling of the deep learning framework.

[0129] Further, in some embodiments, the input information for the static function comprises an input information list, the input information list including an input tensor list, and the structure includes at least one specialization substructure, each of the at least one specialization substructure having a corresponding data type, the data types including tensor and non-tensor.

[0130] For example, the input of the static function in the normalized form may be an input information list, and the input information list may further include an input tensor list and an attribute list, and the attribute list is used to store input variables of other data types. In one example, the data types of the input variables include a tensor type (tensor), an integer type (int), and a floating-point type (float), and are represented as tensor1, tensor2, int, and float. The input information list of the static function may include a tensor list (tensor1, tensor2) and an attribute list (int, float).

[0131] For example, the input information list can be obtained using the template parameter resolution mechanism of C++.

[0132] Hereinafter, with reference to FIG. 4, a detailed description will be given of an operator processing method of a deep learning framework according to an embodiment of the present disclosure.

[0133] FIG. 4 is a flowchart of an operator processing method of a deep learning framework according to one embodiment of the present disclosure.

[0134] As shown in Figure 4, the method 441 can realize the normalization of the operator kernel function input information and the function pointer, which will be described in detail below with reference to operations S4411 to S4415.

[0135] In operation S4411, an operator to be registered is obtained.

[0136] For example, the operator to be registered includes operator description information to be registered and an operator kernel function to be registered. The operator description information to be registered includes operator input information to be registered and operator output information to be registered. The operator kernel function to be registered is used to describe the main calculation logic of the operator.

[0137] In operation S4412, at least one sub-structure is identified based on the structure corresponding to the complete template parameters of the operator to be registered.

[0138] For example, the operator to be registered may be created based on multiple complete template parameters. Each complete template parameter may correspond to a structure. The structure may be preset, for example. The structure may take a function return value, a variable function parameter list, and a function pointer as template parameters, where the return type of the function pointer matches the types in the parameter list and the template parameter. The structure includes a static function for a calculation. The static function has a normalized form.

[0139] Also for example, the structure may include at least one specialization substructure, for example, the specialization substructure is used to perform template parameter derivation.

[0140] In operation S4413, one specialized sub-structure is matched with the input information of the operator to be registered to obtain the input sub-information of the static function of the structure.

[0141] For example, a specialized implementation of each specialized substructure can be predefined to match a structure of a particular data type, with each specialized implementation of the substructure taking the data type that matches the structure as its first template parameter, followed by the rest of the template parameter list.

[0142] Also for example, the at least one specialized substructure may include one specialized substructure having an end marker, the specialized substructure having the end marker may have the end marker as a template parameter.

[0143] For example, a specialization substructure may include a substatic function that takes a parameter index as a template parameter and uses it to mark which parameter has been matched.

[0144] In operation S4414, it is determined whether an end marker has been matched.

[0145] If an end marker is matched, operation S4415 is performed and the flow ends.

[0146] If the end marker is not matched, the process returns to operation S4413 to match based on the next substructure.

[0147] For example, during the compilation process, the compiler analyzes the input information of the operator kernel function one by one. If the currently analyzed input information matches the first template parameter of a specific implementation of the substructure defined above, the compiler calls the specific implementation of the specific substructure to complete the analysis of the current parameters. Then, the compiler continues to match the remaining input information with other specific substructures to analyze the subsequent input information. If the input information matches a specific substructure with an end marker as a template parameter, the matching is completed.

[0148] Furthermore, in some embodiments, the functional form of the function having the normalized form may be as follows:

[0149] Return Tensor List Operator Computation Function Name (Input Tensor List) { ...}.

[0150] FIG. 5 is a flowchart of an operator processing method of a deep learning framework according to another embodiment of the present disclosure.

[0151] In operation S510, the operator to be processed is acquired.

[0152] For example, the processed operator includes an operator kernel function and a template parameter, which is independent of the deep learning framework and is used to distribute the processed operator.

[0153] Next, in response to receiving input information for the operator to be processed, the method 500 uses the input information to analyze the template parameters to obtain a plurality of complete template parameters depending on the deep learning framework, which will be described in detail below with reference to operations S521 to S523.

[0154] In operation S521, a variable parameter list is created using a macro.

[0155] In operation S522, the template parameters are iteratively parsed using the variable parameter list to obtain a number of internal template parameters.

[0156] In operation S523, the multiple inner template parameters are spliced ​​to obtain multiple complete template parameters.

[0157] It can be understood that for a detailed description of operation S522 and operation S523, reference can be made to the above-mentioned operation S2211 and operation S2212, and the present disclosure will not repeat the description here.

[0158] Then, the method 500 can process the operator kernel function based on the multiple complete template parameters to obtain an available operator for the deep learning framework, which will be described in detail below with reference to operations S531, S532 and S533.

[0159] In operation S531, a number of complete template parameters are explicitly instantiated.

[0160] In an embodiment of the present disclosure, each of the plurality of complete template parameters includes template function description information and template function information.

[0161] For example, the template function description information is instantiated as a header file. The template function description information may be a template function declaration. The header file may be, for example, a ".h" file.

[0162] For example, the template function information is instantiated as a source code file. The template function information may be a template function implementation. The source code file may be, for example, a ".cc" file.

[0163] In the C++ programming language, the kernel format for applying template functions has certain limitations. During compilation, the template function must be instantiated based on the actual template parameter type, and the implementation of the template function must also be expanded to the corresponding call site. By instantiating the template function description information in a header file and the source code file in a source code file, it is possible to avoid introducing and expanding a large amount of template function code during compilation, which affects compilation efficiency.

[0164] In operation S532, the complete template parameter input information is converted into corresponding parameter information.

[0165] It can be understood that for a detailed description of operation S532, reference can be made to the above-mentioned method 330, and the present disclosure will not repeat the description here.

[0166] In operation S533, the input information and function pointer of the operator kernel function to be registered are normalized.

[0167] It can be understood that for a detailed description of operation S533, reference can be made to the above-mentioned method 441, and the present disclosure will not repeat the description here.

[0168] In operation S540, the operator is registered in a global operator table within the deep learning framework.

[0169] For example, after performing operation S532 or operation S533, information for registering the operator in the global operator table can be obtained. The information may include, for example, corresponding parameter information of the operator kernel function and / or a normalized function pointer.

[0170] In operation S550, available operators are retrieved based on the global operator table.

[0171] In some embodiments, template functions may be explicitly instantiated in the source code files mentioned above.

[0172] For example, in a header file, the template function description information may be, for example:

[0173]

number

[0174] For example, in a source code file, you explicitly instantiate the function ScaleKernel<float、 CPUContext> may be, for example, as follows:

[0175]

number

[0176] If there are eight data types and two device types, the code corresponding to the explicitly instantiated functions may include 16 pairs.

[0177] In another embodiment, multiple instantiated statements can be generated based on multiple complete template parameters, such as:

[0178]

number

[0179] Here, decltype is a method to automatically analyze function types, thus improving compilation efficiency and writing less indirection, and completing this explicit instantiation process automatically.

[0180] In some embodiments, the global operator table includes an operator kernel factory class, an operator kernel name class and kernel key value class, and an operator kernel class, for example, the operator kernel class includes at least one of a pointer to an operator kernel function, description information of an operator kernel function input parameter, and description information of an operator kernel function output parameter.

[0181] The global operator table will now be described in detail with reference to FIG.

[0182] FIG. 6 is an exemplary schematic diagram of a global operator table according to one embodiment of the present disclosure.

[0183] As shown in FIG. 6, the data structure of the global operator table 600 may include a first-class operator kernel factory class 610 , a second-class operator kernel name class 620 , a kernel key value class 630 , and an operator kernel class 640 .

[0184] 6, the operator kernel class 640 may include a pointer 641 to a third-class operator kernel function and description information of operator kernel function parameters 642. The description information of operator kernel function parameters 642 may include, for example, description information of operator kernel function input parameters and description information of operator kernel function output function.

[0185] In some examples, processing the operator kernel function based on the plurality of complete template parameters to obtain usable operators for the deep learning framework includes processing the operator kernel function by explicitly instantiating the plurality of complete template parameters to obtain usable operators for the deep learning framework.

[0186] In some embodiments, each of the plurality of complete template parameters includes template function description information and template function information, and processing the operator kernel function by explicitly instantiating the plurality of complete template parameters to obtain usable operators for the deep learning framework includes instantiating the template function description information as a header file and instantiating the template function information as a source code file.

[0187] FIG. 7 is a block diagram of an operator processing unit of a deep learning framework according to one embodiment of the present disclosure.

[0188] As shown in FIG. 7, the apparatus 700 may include an acquisition module 710, an analysis module 720, and a processing module 730.

[0189] The acquisition module 710 is used to acquire a target operator, for example, the target operator includes an operator kernel function and a deep learning framework independent template parameter.

[0190] The parsing module 720 is used, in response to receiving input information for the operator to be processed, to parse the template parameters using the input information to obtain a plurality of complete template parameters depending on the deep learning framework.

[0191] The processing module 730 is used to process the operator kernel functions based on the complete template parameters to obtain usable operators for the deep learning framework.

[0192] In some embodiments, the analysis module includes a creation sub-module for creating a variable parameter list using a macro, and a analysis sub-module for iteratively analyzing template parameters based on the variable parameter list, where the input information is macro parameters of the macro.

[0193] In some embodiments, the variable parameter list includes a name of the operator to be processed, a name of the operator kernel function, a data layout of the operator kernel function, an equipment type for implementing the deep learning framework, and a data type for implementing the deep learning framework.

[0194] In some embodiments, the analysis submodule includes a first identification unit for identifying the number of parameters included in the macro, a second identification unit for identifying an iteration end position according to the number of parameters, and a processing unit for processing the input information into iterations according to the iteration end position using a variable parameter list.

[0195] In some embodiments, the parsing submodule further includes a parsing unit for iteratively parsing the template parameters using the variable parameter list to obtain a plurality of inner template parameters, and a splicing unit for splicing the plurality of inner template parameters to obtain a plurality of complete template parameters.

[0196] In some embodiments, the internal template parameters include a plurality of character strings, and the splicing unit includes a splicing subunit for splicing the plurality of character strings based on the input information to obtain a plurality of complete template parameters for the processed operator.

[0197] In some embodiments, the processing module includes an explicit instantiation sub-module to process the operator kernel functions by explicitly instantiating a number of complete template parameters to obtain usable operators for the deep learning framework.

[0198] In some embodiments, each of the plurality of complete template parameters includes template function description information and template function information, and the explicit instantiation submodule includes a first instantiation unit for instantiating the template function description information as a header file and a second instantiation unit for instantiating the template function information as a source code file.

[0199] In some embodiments, the processing module includes: for each complete template parameter of the plurality of complete template parameters, a first identification sub-module for identifying a function parameter type of the complete template parameter; a conversion sub-module for converting input information of the complete template parameter into corresponding parameter information based on the function parameter type; and a recording sub-module for recording the corresponding parameter information.

[0200] In some embodiments, the apparatus 700 further includes a creation module for creating a registered operator based on the deep learning framework based on the plurality of complete template parameters, and a registration module for registering the registered operator in a global operator table within the deep learning framework.

[0201] In some embodiments, the operator to be registered includes operator description information to be registered and an operator kernel function to be registered, the operator kernel function to be registered includes normalized input information and a normalized function pointer, and the creation module includes: for each complete template parameter of the plurality of complete template parameters, a second identification sub-module for identifying a structure including a static function having a normalized form corresponding to the complete template parameter, a first normalization sub-module for making the input information of the static function into normalized input information, and a second normalization module for making the function pointer of the static function into a normalized function pointer.

[0202] In some embodiments, the input information for the static function comprises an input information list, the input information list including an input tensor list, the structure including at least one specialization substructure, each of the at least one specialization substructure including a corresponding data type, the data types including tensors and non-tensors.

[0203] In some embodiments, the global operator table includes an operator kernel factory class, an operator kernel name class and a kernel key value class, and an operator kernel class.

[0204] In some embodiments, the operator kernel class includes at least one of a pointer to an operator kernel function, description information of operator kernel function input parameters, and description information of operator kernel function output parameters.

[0205] In some embodiments, deep learning framework-independent template parameters are used to distribute the operators to be processed, the deep learning framework-independent template parameters including template parameters that are independent of both an implementation device of the deep learning framework and a data type of the deep learning framework.

[0206] In some embodiments, the apparatus 700 further includes an invocation module for invoking the available operator in response to a invocation command for the available operator, and an execution module for compiling the invoked available operator to execute a function corresponding to the available operator.

[0207] In the technical solution disclosed herein, the collection, storage, use, processing, transmission, provision, disclosure, application and other processes of the user's personal information comply with the provisions of relevant laws and regulations, take necessary security measures, and are not contrary to public order and good morals. In the technical solution disclosed herein, the permission or consent of the user is obtained before obtaining or collecting the user's personal information.

[0208] According to an embodiment of the present disclosure, the present disclosure provides an electronic device, a readable storage medium, and a computer program. M More to offer.

[0209] 8 shows a schematic block diagram of an exemplary electronic device 800 for implementing embodiments of the present disclosure. The electronic device is intended to represent various types of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframes, and other suitable computers. The electronic device may also represent various types of mobile devices, such as personal digital assistants, mobile phones, smartphones, wearable devices, and other similar computing devices. The components, their connections and relationships, and their functions shown herein are merely exemplary and do not limit the implementation of the present disclosure as described and / or claimed herein.

[0210] 8, the electronic device 800 includes a computing means 801, which may perform various appropriate operations and processes based on a computer program stored in a read-only memory (ROM) 802 or loaded from a storage means 808 into a random access memory (RAM) 803. The RAM 803 may further store various programs and data necessary for the operation of the electronic device 800. The computing means 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0211] A number of components in the electronic device 800 are connected to an I / O interface 805, and include input means 806 such as a keyboard, a mouse, etc., output means 807 such as various types of displays, speakers, etc., storage means 808 such as a magnetic disk, an optical disk, etc., and communication means 809 such as a network card, a modem, a wireless communication transceiver, etc. The communication means 809 enables the electronic device 800 to exchange information and data with other devices via a computer network such as the Internet and / or various electric networks.

[0212] The computing means 801 may be various general-purpose and / or dedicated processing modules having processing and computing capabilities. Some examples of the computing means 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, computing units running various machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing means 801 performs each of the methods and processes described in the preceding sentence, such as the operator processing method of the deep learning framework. For example, in some embodiments, the operator processing method of the deep learning framework may be realized as a computer software program tangibly embodied in a machine-readable medium, such as the storage means 808. In some embodiments, some or all of the computer program may be loaded and / or installed in the electronic device 800 via the ROM 802 and / or the communication means 809. When the computer program is loaded into the RAM 803 and executed by the computing means 801, it may perform one or more steps of the operator processing method of the deep learning framework described in the preceding sentence. Alternatively, in other embodiments, the computing means 801 may be configured to perform the operator processing methods of the deep learning framework in any other suitable manner (e.g., via firmware).

[0213] Various embodiments of the systems and techniques described herein above may be realized in digital electronic circuitry systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may be embodied in one or more computer programs that may be executed and / or interpreted by a programmable system that includes at least one programmable processor, which may be a special purpose or general purpose programmable processor, and may include capable of receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.

[0214] The program codes for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, a special purpose computer or other programmable data processing apparatus, so that when the program codes are executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are performed. The program codes may be fully executed on the device, partially executed on the device, partially executed on the device as a separate software package and partially executed on a remote device or fully executed on a remote device or server.

[0215] In the context of this disclosure, a machine-readable medium may be a tangible medium, and may contain or store a program for use in or in combination with an instruction execution system, device, or electronic device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or electronic device, or any suitable combination of the above. More specific examples of machine-readable storage media include electrical connections through one or more wires, portable computer disks, hard disks, random access memories (RAMs), read-only memories (ROMs), erasable programmable read-only memories (EPROMs or flash memories), optical fibers, compact disk read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the above.

[0216] A computer may implement the systems and techniques described herein to provide for interaction with a user, the computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user, and a keyboard and pointing device (e.g., a mouse or trackball) through which a user can provide input to the computer. Other types of devices may also provide for interaction with a user, for example, the feedback provided to the user may be any form of sensing feedback (e.g., visual feedback, auditory feedback, or tactile feedback) and may receive input from the user in any form (including voice input, speech input, or tactile input).

[0217] The systems and techniques described herein may be implemented in a computing system including background components (e.g., a data server), or a computing system including middleware components (e.g., an application server), or a computing system including front-end components (e.g., a user computer having a graphical user interface or a web browser through which a user may interact with embodiments of the systems and techniques described herein), or a computing system including any combination of such background, middleware, or front-end components. The components of the system may be connected to each other by any form or medium of digital data communication (e.g., a communications network). Examples of communications networks illustratively include a local area network (LAN), a wide area network (WAN), and the Internet.

[0218] The computer system may include a client and a server. The client and server are generally remote and typically interact through a communication network. The relationship between the client and the server is created by computer programs running on the corresponding computers and having a client-server relationship. The server may be a cloud server, a server in a distributed system, or a server in combination with a blockchain.

[0219] It should be understood that various types of flows shown above may be used, and operations may be rearranged, added, or removed. For example, each operation described in the present disclosure may be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved, and the present specification is not limited thereto.

[0220] The above specific embodiments do not limit the scope of protection of the present disclosure. Those skilled in the art should understand that various modifications, combinations, subcombinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements and improvements made within the spirit and principle of the present disclosure should be included within the scope of protection of the present disclosure.

Claims

1. A method for operator processing in a deep learning framework, comprising: Obtaining a target operator including an operator kernel function and a deep learning framework-independent template parameter; In response to receiving input information for the target operator, parsing the template parameters using the input information to obtain a plurality of complete template parameters dependent on a deep learning framework; and processing the operator kernel function based on a plurality of complete template parameters to obtain available operators for the deep learning framework. How deep learning frameworks handle operators.

2. In response to receiving input information for the target operator, parsing the template parameters using the input information to obtain a plurality of complete template parameters dependent on a deep learning framework, Creating a variable parameter list using a macro; parsing the template parameters into iterations based on the variable parameter list; Here, the input information is used as a macro parameter of the macro. The method of claim 1.

3. The variable parameter list includes: The name of the operator to be processed, The name of the operator kernel function; A data layout of the operator kernel function; and A device type for implementing the deep learning framework; and and a data type for implementing the deep learning framework. The method of claim 2.

4. Parsing the template parameters into iterations based on the variable parameter list includes: Identifying the number of parameters included in the macro; determining an iteration end position according to the number of parameters; and processing the input information into iterations according to the iteration end position using a variable parameter list. The method of claim 2.

5. Parsing the template parameters into iterations based on the variable parameter list includes: iteratively parsing the template parameters using the variable parameter list to obtain a plurality of internal template parameters; splicing the plurality of internal template parameters to obtain the plurality of complete template parameters. The method of claim 2.

6. The plurality of internal template parameters includes a plurality of character strings, and splicing the plurality of internal template parameters to obtain the plurality of complete template parameters includes: splicing the plurality of strings based on the input information to obtain a plurality of complete template parameters for the target operator. The method according to claim 5.

7. Processing the operator kernel function based on a plurality of complete template parameters to obtain an available operator for the deep learning framework includes: and processing the operator kernel function by explicitly instantiating the complete template parameters to obtain available operators for the deep learning framework. The method according to claim 5.

8. Each of the plurality of complete template parameters includes template function description information and template function information, and processing the operator kernel function by explicitly instantiating the plurality of complete template parameters to obtain available operators for the deep learning framework includes: instantiating the template function description information as a header file; instantiating the template function information as a source code file. The method of claim 7.

9. Processing the operator kernel function based on the plurality of complete template parameters to obtain available operators for the deep learning framework includes: for each complete template parameter of the plurality of complete template parameters, identifying a function parameter type of the complete template parameter; converting the complete template parameter input information into corresponding parameter information based on the function parameter type; and recording the corresponding parameter information. The method according to claim 5.

10. Creating a registered operator based on the deep learning framework based on the plurality of complete template parameters; and registering the operator to be registered in a global operator table within the deep learning framework. The method according to claim 5.

11. The registered operator includes registered operator description information and a registered operator kernel function, and the registered operator kernel function includes normalized input information and a normalized function pointer. Creating a registered operator based on the deep learning framework based on the multiple complete internal template functions includes: identifying, for each complete template parameter of the plurality of complete template parameters, a structure including a static function having a canonical form corresponding to the complete template parameter; The input information of the static function is the normalized input information; and making the function pointer of the static function the normalized function pointer. The method of claim 10.

12. The input information of the static function comprises an input information list, the input information list including an input tensor list, and the structure includes at least one specialized substructure, each of the at least one specialized substructure having a corresponding data type. The method of claim 11.

13. The global operator table includes: an operator kernel factory class; an operator kernel name class and a kernel key value class; operator kernel class, The method of claim 10.

14. The operator kernel class is A pointer to the operator kernel function; Descriptive information of the operator kernel function input parameters; and description information of the operator kernel function output parameters. The method of claim 13.

15. The deep learning framework-independent template parameters are used to distribute the operator to be processed, and the deep learning framework-independent template parameters include template parameters that are independent of both an implementation device of the deep learning framework and a data type of the deep learning framework. The method of claim 1.

16. invoking the available operator in response to a call command for the available operator; and compiling the called available operator to execute a function corresponding to the available operator. The method of claim 1.

17. 1. An operator processing unit of a deep learning framework, comprising: an acquisition module for acquiring a target operator including an operator kernel function and a template parameter that is independent of a deep learning framework; a parsing module for, in response to receiving input information for the target operator, parsing the template parameters using the input information to obtain a plurality of complete template parameters dependent on a deep learning framework; and a processing module for processing the operator kernel function based on a plurality of complete template parameters to obtain an available operator for the deep learning framework. Operator processing unit for deep learning frameworks.

18. The analysis module includes: a creation sub-module for creating a variable parameter list using a macro; a parsing submodule for parsing the template parameters into iterations based on the variable parameter list; Here, the input information is used as a macro parameter of the macro.

20. The apparatus of claim 17.

19. The variable parameter list includes: The name of the operator to be processed, The name of the operator kernel function; A data layout of the operator kernel function; and A device type for implementing the deep learning framework; and and a data type for implementing the deep learning framework.

20. The apparatus of claim 18.

20. The analysis submodule: a first identification unit for identifying the number of parameters included in the macro; a second identifying unit for identifying an iteration end position according to the number of parameters; a processing unit for processing the input information into iterations according to the iteration end position using a variable parameter list.

20. The apparatus of claim 18.

21. The analysis submodule: a parsing unit for iteratively parsing the template parameters using the variable parameter list to obtain a plurality of internal template parameters; a splicing unit for splicing the plurality of internal template parameters to obtain the plurality of complete template parameters. Apparatus according to any one of claims 18 to 20.

22. The internal template parameters include a plurality of character strings, and the splicing unit: a splicing subunit for splicing the plurality of character strings based on the input information to obtain a plurality of complete template parameters for the target operator.

22. The apparatus of claim 21.

23. The processing module includes: an explicit instantiation submodule for processing the operator kernel functions by explicitly instantiating the complete template parameters to obtain available operators for the deep learning framework; 22. The apparatus of claim 21.

24. Each of the plurality of complete template parameters includes template function description information and template function information, and the explicit instantiation sub-module: a first instantiation unit for instantiating the template function description information as a header file; a second instantiation unit for instantiating the template function information as a source code file.

24. The apparatus of claim 23.

25. The processing module includes: a first identification sub-module for identifying, for each complete template parameter of the plurality of complete template parameters, a function parameter type of the complete template parameter; a conversion sub-module for converting the complete template parameter input information into corresponding parameter information based on the function parameter type; a recording sub-module for recording the corresponding parameter information.

22. The apparatus of claim 21.

26. A creation module for creating a registered operator based on the deep learning framework based on the plurality of complete template parameters; A registration module for registering the operator to be registered in a global operator table within the deep learning framework.

22. The apparatus of claim 21.

27. The operator to be registered includes operator description information and an operator kernel function to be registered, and the operator kernel function to be registered includes normalized input information and a normalized function pointer, and the creating module is: a second identification sub-module for identifying, for each complete template parameter of the plurality of complete template parameters, a structure including a static function having a normalized form corresponding to the complete template parameter; a first normalization sub-module for normalizing the input information of the static function into the normalized input information; a second normalization module for normalizing the function pointer of the static function to the normalized function pointer.

27. The apparatus of claim 26.

28. The input information of the static function comprises an input information list, the input information list including an input tensor list, and the structure includes at least one specialized substructure, each of the at least one specialized substructure having a corresponding data type.

28. The apparatus of claim 27.

29. The global operator table includes: an operator kernel factory class; an operator kernel name class and a kernel key value class; operator kernel class, 27. The apparatus of claim 26.

30. The operator kernel class is A pointer to the operator kernel function; Descriptive information of the operator kernel function input parameters; and description information of the operator kernel function output parameters.

30. The apparatus of claim 29.

31. The deep learning framework-independent template parameters are used to distribute the operator to be processed, and the deep learning framework-independent template parameters include template parameters that are independent of both an implementation device of the deep learning framework and a data type of the deep learning framework.

20. The apparatus of claim 17.

32. an invocation module for invoking the available operator in response to a invocation command for the available operator; and an execution module for executing a function corresponding to the available operator by compiling the called available operator.

20. The apparatus of claim 17.

33. At least one processor; a memory in communication with the at least one processor; said memory storing instructions executable by said at least one processor, said instructions being executed by said at least one processor to cause said at least one processor to execute the method according to any one of claims 1 to 16; electronic equipment.

34. storing computer instructions for causing a computer to carry out the method according to any one of claims 1 to 16; A non-transitory computer-readable storage medium.

35. A computer program which, when executed by a processor, implements the method according to any one of claims 1 to 16.

Citation Information

Patent Citations

  • Model generation method and device, electronic equipment and storage medium

    CN111310934A

  • Deep learning compilation optimization method for intelligently selecting compilation acceleration library

    CN113031966A

  • Deep learning framework operator registration method and device, equipment and storage medium

    CN113342346A

  • Processing unit, calculation device and calculation graph optimization method of deep learning model

    CN113705798A

  • Unified code and data management for model development

    US10956132B1