Model determination method and device, equipment, medium and product

By analyzing the feature analysis and similarity matching of operators to be replaced in deep learning models, the operator incompatibility problem in cross-platform model adaptation is solved, and the efficiency and accuracy of model conversion and deployment are improved. sex.

CN119312834APending Publication Date: 2025-01-14HUNAN KAIHONG ZHIGU DIGITAL IND DEV CO LTD
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202411560832.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-04
Publication Date
2025-01-14

AI Technical Summary

Technical Problem

In the cross-platform adaptation process of deep learning models, operator incompatibility leads to complex model conversion and deployment, and existing manual operator replacement is time-consuming and labor-intensive and difficult to guarantee.

Method used

By obtaining the operator support library of the model to be replaced and the target platform, the characteristics of the operator to be replaced are analyzed, and the matching target operator is found in the operator support library based on similarity matching, and the target platform is replaced to generate a matching target platform target model.

Benefits of technology

It improves the rationality and efficiency of operator replacement, can more efficiently screen out the most suitable operator replacement solution, and simplifies the cross-platform adaptation process of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119312834A_ABST
    Figure CN119312834A_ABST
Patent Text Reader

Abstract

The invention discloses a model determination method and device, equipment, a medium and a product, and the method comprises the steps: obtaining a to-be-replaced model and an operator support library of a target platform, the target platform being a platform to be converted by a to-be-converted model; analyzing the characteristics of each operator to be replaced contained in the model to be replaced, and determining operator related information of each operator to be replaced; based on the relevant information of each operator, performing similarity matching in an operator support library to obtain a target operator matched with the operator to be replaced; and replacing the operator to be replaced based on the target operator to obtain a target model adaptive to the target platform. The characteristics of operators are analyzed to obtain operator related information, analysis and comparison are performed in an operator support library pre-constructed for a target platform based on the operator related information, and the similarity with the operator to be replaced is determined, so that the optimal target operator is found, the reasonability of operator replacement is enhanced, and the accuracy of operator replacement is improved. And the most suitable operator replacement scheme can be more efficiently screened out.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of algorithm optimization technology, and in particular to a model determination method, device, equipment, medium and product. Background Art

[0002] In the process of cross-platform adaptation of deep learning models, operators used by different computing frameworks (such as PyTorch, TensorFlow, PaddlePaddle, etc.) may be incompatible. Due to differences in hardware platforms and supported operator libraries, models often face the problem of being unable to be successfully ported and run efficiently during the conversion process.

[0003] Existing model conversion and deployment solutions usually require manual operator replacement and debugging. However, due to the different types of operators supported by different platforms and different performance optimization levels, manual operator adaptation is not only time-consuming and labor-intensive, but the replacement effect cannot be guaranteed, which greatly increases the complexity of development and deployment. Summary of the invention

[0004] The present invention provides a model determination method, device, equipment, medium and product to achieve conversion of incompatible operators in a cross-platform model.

[0005] According to a first aspect of the present invention, there is provided a model determination method, comprising:

[0006] Obtaining the operator support library of the model to be replaced and the target platform, wherein the target platform is the platform to which the model to be converted is to be converted;

[0007] Analyze the characteristics of each operator to be replaced contained in the model to be replaced, and determine operator-related information of each operator to be replaced;

[0008] Based on the relevant information of each operator, similarity matching is performed in the operator support library to obtain a target operator that matches the operator to be replaced;

[0009] The operator to be replaced is replaced based on the target operator to obtain a target model adapted to the target platform.

[0010] According to a second aspect of the present invention, there is provided a model determination device, comprising:

[0011] A model determination module, used to obtain the model to be replaced and the operator support library of the target platform, wherein the target platform is the platform to which the model to be converted is to be converted;

[0012] An information determination module, used to analyze the characteristics of each operator to be replaced contained in the model to be replaced, and determine operator-related information of each operator to be replaced;

[0013] An operator determination module, configured to perform similarity matching in the operator support library based on the relevant information of each operator, and obtain a target operator matching the operator to be replaced;

[0014] An operator replacement module is used to replace the operator to be replaced based on the target operator to obtain a target model adapted to the target platform.

[0015] According to a third aspect of the present invention, there is provided an electronic device, the electronic device comprising:

[0016] at least one processor; and

[0017] a memory communicatively connected to the at least one processor; wherein,

[0018] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the model determination method described in any embodiment of the present invention.

[0019] According to a fourth aspect of the present invention, there is provided a computer-readable storage medium storing computer instructions for enabling a processor to implement the model determination method described in any embodiment of the present invention when the computer instructions are executed.

[0020] According to a fifth aspect of the present invention, an embodiment of the present invention further provides a computer program product, the computer program product comprising a computer program, and when the computer program is executed by a processor, the model determination method of any embodiment of the present invention is implemented.

[0021] The technical solution of the embodiment of the present invention is to obtain the operator support library of the model to be replaced and the target platform, wherein the target platform is the platform to which the model to be converted is to be converted; the characteristics of each operator to be replaced contained in the model to be replaced are analyzed to determine the operator-related information of each operator to be replaced; based on the relevant information of each operator, similarity matching is performed in the operator support library to obtain a target operator matching the operator to be replaced; based on the target operator, the operator to be replaced is replaced to obtain a target model adapted to the target platform. By analyzing the characteristics of the operator, the operator-related information is obtained, and based on the operator-related information, the operator support library pre-built for the target platform is analyzed and compared to determine the similarity with the operator to be replaced, thereby finding the optimal target operator, enhancing the rationality of operator replacement, and being able to more efficiently screen out the most suitable operator replacement scheme.

[0022] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0024] Figure 1 is a flow chart of a model determination method provided according to Embodiment 1 of the present invention;

[0025] Figure 2 is a flow chart of a model determination method provided according to Embodiment 2 of the present invention;

[0026] Figure 3 is a structural diagram of a model determination device provided according to Embodiment 3 of the present invention;

[0027] Figure 4 It is a schematic diagram of the structure of an electronic device implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0028] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0030] Embodiment 1

[0031] Figure 1A flowchart of a model determination method is provided for the first embodiment of the present invention. This embodiment is applicable to the case of replacing operators of incompatible models across platforms. The method can be executed by a model determination device, which can be implemented in the form of hardware and / or software, and can be configured in an electronic device. Figure 1 As shown, the method includes:

[0032] S110: Obtain the operator support library of the model to be replaced and the target platform, where the target platform is the platform to which the model to be converted is to be converted.

[0033] In this embodiment, the model to be replaced can be understood as a deep learning model that needs to be adapted across platforms, and the model to be replaced includes multiple operators. The target platform can be understood as the processing platform to be adapted. The operator support library can be understood as a library of many operators that provide different functions pre-built in the target platform. The static, dynamic and topological feature vectors of each operator can be created in advance by performing a comprehensive feature analysis on the operators supported by the target platform, and saved in the operator support library.

[0034] Specifically, operators used by different deep learning frameworks (such as PyTorch, TensorFlow, and PaddlePaddle) often have incompatibility issues when deployed across platforms. This method targets models to be replaced that have incompatibility issues. The processor can obtain the model to be replaced, determine the target platform to which the model to be replaced is to be adapted, search the storage device for the pre-built operator support library corresponding to the target platform, and obtain the operator support library.

[0035] S120 , analyzing the characteristics of each operator to be replaced contained in the model to be replaced, and determining operator-related information of each operator to be replaced.

[0036] In this embodiment, the operator to be replaced can be understood as an operator that is not compatible with the target platform. The operator-related information can be understood as auxiliary information used to characterize operator features and determine the target operator.

[0037] Specifically, the processor can determine the operators to be replaced that have problems in the model to be replaced, for example, by running the model to be replaced on the target platform to find the operators with problems as the operators to be replaced. By analyzing the structural characteristics of the model to be replaced and the characteristics of each operator to be replaced, such as determining the name, type, input and output tensors, mathematical characteristics, and calculation path of each operator to be replaced, the operator-related information of each operator to be replaced is obtained.

[0038] S130 . Based on the relevant information of each operator, perform similarity matching in the operator support library to obtain a target operator that matches the operator to be replaced.

[0039] In this embodiment, the target operator can be understood as an operator that matches the operator to be replaced on the target platform.

[0040] Specifically, for each operator to be replaced, the processor can perform similarity calculation on the corresponding operator-related information and the relevant information of each operator in the operator support library. For example, the operator-related information can be screened by the features that characterize the operator functions, and then the screened operators can be calculated for similarity by combining other multiple features in the operator-related information with information that assists in similarity calculation, and the operator with the greatest similarity is screened out as the target operator that matches the operator to be replaced.

[0041] S140 , replacing the operator to be replaced based on the target operator to obtain a target model adapted to the target platform.

[0042] In this embodiment, the target model can be understood as a model that is suitable for the target platform after replacement.

[0043] Specifically, the processor may replace the operator to be replaced in the model to be replaced with the target operator, wherein normal operators without problems in the model to be replaced may be retained to obtain a target model adapted to the target platform.

[0044] The technical solution of the embodiment of the present invention is to obtain the operator support library of the model to be replaced and the target platform, wherein the target platform is the platform to which the model to be converted is to be converted; the characteristics of each operator to be replaced contained in the model to be replaced are analyzed to determine the operator-related information of each operator to be replaced; based on the relevant information of each operator, similarity matching is performed in the operator support library to obtain a target operator matching the operator to be replaced; based on the target operator, the operator to be replaced is replaced to obtain a target model adapted to the target platform. By analyzing the characteristics of the operator, the operator-related information is obtained, and based on the operator-related information, the operator support library pre-built for the target platform is analyzed and compared to determine the similarity with the operator to be replaced, thereby finding the optimal target operator, enhancing the rationality of operator replacement, and being able to more efficiently screen out the most suitable operator replacement scheme.

[0045] Embodiment 2

[0046] Figure 2 This is a flow chart of a model determination method provided in the second embodiment of the present invention. This embodiment is a further optimization of the above embodiment. Figure 2 As shown, the method includes:

[0047] S201. Obtain the operator support library of the model to be replaced and the target platform, where the target platform is the platform to which the model to be converted is to be converted.

[0048] S202: Analyze the characteristics of each operator to be replaced contained in the model to be replaced, and determine operator-related information of each operator to be replaced.

[0049] S203. The operator-related information includes the operator characteristic vector and the operator context relationship. For each operator to be replaced, a candidate operator set is screened from the operator support library according to the basic attribute vector in the operator characteristic vector.

[0050] In this embodiment, the operator feature vector can be understood as the characteristics of the operator in the form of a feature vector. The operator context relationship can be understood as the order relationship of the calculation logic between each operator when calculating through the model to be replaced. The basic attribute vector can be understood as a vector reflecting the basic characteristics of the operator to be replaced, such as the name and type of the operator. The candidate operator set can be understood as a set of multiple candidate operators with the same basic attributes as the operator to be screened.

[0051] The operator characteristic vector includes: static characteristic sub-vector, dynamic characteristic sub-vector, calculation path sub-vector and topological characteristic sub-vector.

[0052] Specifically, as a method of determining a target operator, the operator-related information may include an operator characteristic vector and an operator context relationship. For each operator to be replaced, the processor may first match the basic attribute vector in the operator characteristic vector with the operator basic attribute vector of each operator in the operator support library, and obtain a candidate operator set through pre-screening. For example, operators with the same name and type as the operator to be replaced are screened out in the operator support library as candidate operators to obtain a candidate operator set.

[0053] Exemplarily, any operator to be replaced in the model to be replaced is O i , the operator eigenvector V(O i ) can be expressed as:

[0054] V(O i )=[f static (O i ),f dynamic (O i ), f topological (O i )]

[0055] In the formula, f static (O i) represents the static characteristics of an operator, including: operator name and type (using one-hot encoding): directly identifies the basic properties of the operator; the number and shape of input and output tensors: reflects the data processing capability and scale of the operator; computational complexity (time and space): quantifies the computational requirements of the operator; FLOPS estimation: accurately quantifies the computational intensity; parameter list and its attributes: describes the configurability and flexibility of the operator; numerical accuracy requirements (supported data types, quantization sensitivity): reflects the numerical characteristics of the operator.

[0056] In the formula, f dynamic (O i ) represents the dynamic characteristics of the operator's calculation process, including: mathematical properties: such as commutativity, associativity, linear / nonlinear characteristics, etc., among which commutativity and associativity can be used to distinguish the calculation logic of certain operators, such as addition and subtraction. For linear / nonlinear characteristics, it further provides differentiation for operator characteristics. For example, addition is a strict linear operation, while matrix multiplication exhibits nonlinear characteristics; calculation path: for the specific calculation logic path of complex operators, the calculation graph can be used for quantification. The calculation logic of the complex operator is represented as a small calculation graph, and then the graph embedding technology, such as Graph2Vec or GraphSAGE, is used to convert this graph into a vector of fixed dimension.

[0057] In the formula, f topological (O i ) represents the topological characteristics of the operator in the model graph, including in-degree, out-degree and centrality measurement, which is used to describe the importance and connection pattern of the operator in the network.

[0058] The operator characteristic vector comprehensively reflects the static, dynamic and topological characteristics of the operator, providing a more comprehensive operator description, so that the determination of the target operator can take into account the overall model structure, thereby improving the rationality of the target operator determination.

[0059] S204 . Determine the similarity between the operator to be replaced and each candidate operator in the candidate operator set based on the operator context relationship, the operator characteristic vector and the candidate operator set.

[0060] In this embodiment, the similarity is used to reflect the matching degree between the operator to be replaced and the candidate operator.

[0061] Specifically, for the effect of the overall model to be replaced, the combination relationship between operators is taken into consideration when each operator is initially set, so the combination effect between adjacent operators still needs to be considered when replacing. The processor can determine the adjacent operators adjacent to the operator to be replaced through the operator context relationship, and calculate the similarity with the characteristic vectors of each candidate operator in the candidate operator set by combining the characteristic vectors of the adjacent operators and the characteristic vector of the operator to be replaced, so as to obtain the similarity between the operator to be replaced and each candidate operator in the candidate operator set.

[0062] Further, based on the above embodiment, the step of determining the similarity between the operator to be replaced and each candidate operator in the candidate operator set based on the operator context relationship, the operator characteristic vector and the candidate operator set can be refined as follows:

[0063] Obtain the context weight coefficient and the operator weight coefficient; based on the operator context relationship, determine the set of context operators adjacent to the operator to be replaced in the model to be replaced, the context operator set including the operator to be replaced, the preceding operator and the following operator adjacent to the operator to be replaced; determine the similarity between the operator to be replaced and each candidate operator in the candidate operator set according to the context operator set, the context weight coefficient, the operator weight coefficient and the candidate operator set.

[0064] In this embodiment, the context weight coefficient can be understood as the proportion of similarity calculated by the context operator. The operator weight coefficient can be understood as the proportion of similarity of the operator to be replaced. The context operator set can be understood as the set of operators adjacent to the operator to be replaced. The above operator can be understood as the operator calculated one step earlier than the operator to be replaced in the model to be replaced. The below operator can be understood as the operator calculated one step later than the operator to be replaced in the model to be replaced.

[0065] Specifically, the processor can obtain the context weight coefficient and the operator weight coefficient from the storage medium. The processor can determine the structural relationship between operators in the model to be replaced based on the operator context relationship, determine the previous operator calculated in the previous step and the next operator calculated in the next step adjacent to the operator to be replaced, and the processor can determine the context operator set in order, such as obtaining the context operator set in the order of the previous operator, the operator to be replaced and the next operator. The processor can determine the similarity between the operator to be replaced and each candidate operator in the candidate operator set based on the context operator set, the context weight coefficient, the operator weight coefficient and the candidate operator set.

[0066] Among them, based on the above embodiment, the step of determining the similarity between the operator to be replaced and each candidate operator in the candidate operator set according to the context operator set, the context weight coefficient, the operator weight coefficient and the candidate operator set can be refined as follows:

[0067] The context operator similarity is determined according to the context operator set and the candidate feature vectors of each candidate operator in the candidate operator set; the operator similarity is determined according to the operator feature vector and each candidate feature vector; the context operator similarity is weighted based on the context weight coefficient, and the operator similarity is weighted based on the operator weight coefficient to obtain the similarity between the operator to be replaced and each candidate operator in the candidate operator set.

[0068] In this embodiment, the candidate characteristic vector can be understood as a characteristic vector that characterizes the candidate operator, and the content included is consistent with the operator characteristic vector. The context operator similarity can be understood as a similarity that is used to characterize the candidate operator and the context operator set. The operator similarity can be understood as a similarity that is used to characterize the operator to be replaced and the candidate operator.

[0069] Specifically, the processor can perform similarity calculations based on the characteristic vectors of each operator in the context operator set and the candidate characteristic vectors of the candidate operators, and accumulate the calculation results to obtain the context operator similarity between the context set and the candidate operators. The processor can perform similarity calculations based on the operator characteristic vector and the candidate characteristic vector to obtain the operator similarity between the operator to be replaced and the candidate operators. The processor can weight the context operator similarity based on the context weight coefficient, and weight the operator similarity based on the operator weight coefficient to obtain the similarity between the operator to be replaced and each candidate operator in the candidate operator set.

[0070] Among them, the processor can obtain the operating results of the replaced target model, and adjust the context weight coefficient and the operator weight coefficient by adaptive learning based on the operating result feedback to ensure the accuracy of the two weight coefficients.

[0071] Exemplarily, the similarity can be calculated by the following formula:

[0072] Each operator in the operator support library of the target platform can also be represented as a feature vector V(O' k ), where O' k is a candidate operator. In order to find i The most matching target operator needs to calculate O i With each candidate operator O' k The operator similarity S(O i ,O' k ) can be calculated by cosine similarity:

[0073]

[0074] Where · represents the dot product of the vectors, and ∥V(O)∥ represents the norm of the vector V(O). i ,O' k ), the target operator with similar functions can be selected more accurately. The higher the similarity, the more likely the quality of the replaced operator is to be close to the original value, thus better maintaining the model accuracy.

[0075] The set of context operators in the model to be replaced is C(O i )={O i-1 ,O i ,Oi+1},O i-1 represents the above operator, O i+1 Represents the following operators. The processor further optimizes the matching results by calculating the combined effects of these operators and the candidate operators. The optimization goal of the combined effect can be achieved by maximizing the overall similarity:

[0076]

[0077] Among them, α represents the operator weight coefficient, and β represents the context weight coefficient. The context operator similarity can be obtained by Sure, Represents the target operator.

[0078] S205 . Based on the similarities, select a target operator that matches the operator to be replaced from the candidate operator set.

[0079] Specifically, the processor may find a maximum value from the similarities, and use the candidate operator corresponding to the maximum similarity value as the target operator that matches the operator to be replaced.

[0080] S206. The operator-related information includes an operator characteristic vector and a weighting factor. The operator characteristic vector includes at least two characteristic sub-vectors. The sub-similarity of the characteristic sub-vectors is determined according to the operator characteristic vector and the supporting operator characteristic vectors of each supporting operator in the operator support library.

[0081] In this embodiment, the weighting factor can be understood as the weight ratio of each operator characteristic vector when determining the similarity, which can be set according to actual needs. For example, if the user needs a more dynamic operator, the weighting factor of the dynamic feature sub-vector can be increased; if the user needs to complete the operator with the most similar function, the weighting factor of the static feature sub-vector can be increased. The feature sub-vector can be understood as the sub-vectors of different dimensions included in each operator feature vector, for example, it can include static feature sub-vectors, dynamic feature sub-vectors, calculation path sub-vectors, and topological feature sub-vectors. Sub-similarity can be understood as the similarity between each feature sub-vector. Support operators can be understood as operators in the operator support library. Support operator feature vectors can be understood as vectors used to characterize the characteristics of each support operator.

[0082] Specifically, the similarity between the operator to be replaced and the candidate operator can also be determined in another way. When the operator-related information includes an operator characteristic vector and a weighting factor, the operator characteristic vector includes at least two characteristic sub-vectors. The processor can determine the similarity between the operator characteristic vector and the supporting operator characteristic vector corresponding to each supporting operator in the operator support library, and determine the sub-similarity of the characteristic sub-vector. For example, the sub-similarity between each characteristic sub-vector of the operator to be replaced and the characteristic sub-vector of the supporting operator can be calculated by the above cosine similarity.

[0083] S207 . Weight the sub-similarity according to the weighting factor to obtain the total similarity.

[0084] In this embodiment, the total similarity can be understood as the similarity of all sub-similarity values ​​combined to represent the operator to be replaced and the candidate operator.

[0085] Specifically, a weighting factor corresponding to each feature sub-vector may be included, and weighting is performed by multiplying each weighting factor by the corresponding feature sub-vector, and all multiplication results are added together to obtain the total similarity.

[0086] S208 . Based on the total similarities, select a target operator that matches the operator to be replaced from the candidate operator set.

[0087] Specifically, the processor may use the candidate operator with the highest total similarity as the target operator that matches the operator to be replaced.

[0088] S209 , replacing the operator to be replaced based on the target operator to obtain a target model adapted to the target platform.

[0089] The technical solution of the embodiment of the present invention forms an operator characteristic vector by vectorizing the static, dynamic and topological characteristics of the operator, and performs a comprehensive analysis and comparison through the operator characteristic vector when determining the target operator. This vectorized characteristic description enhances the rationality of operator replacement and optimizes the performance of the overall model. A candidate operator set is pre-screened from the operator support library through basic attributes, and a comprehensive analysis is performed on the context operators associated with the candidate operator set and the operator to be replaced to obtain the context operator similarity and operator similarity. The similarity of each context operator and the proportion of operator similarity are corrected by the context weight coefficient and the operator weight coefficient to obtain the similarity between the operator to be replaced and the candidate operator, and then the candidate operator with the highest similarity is used as the target operator, and the replacement effect is optimized through context analysis to ensure that the accuracy and reasoning performance of the model can be maintained after the replacement. The similarity between the operator to be replaced and each sub-feature vector of the supporting operator is corrected by the weighting factor, the total similarity between the operator to be replaced and the supporting operator is determined, and the supporting operator with the highest total similarity is used as the target operator. By introducing the weighting factor, the weight of each feature sub-vector in the similarity calculation is adjusted according to actual needs, so that the algorithm has better flexibility and meets the operator replacement needs of different users, ensuring that the execution effect of the replaced target operator in the overall model is similar to or even better than the original operator.

[0090] Embodiment 3

[0091] Figure 3 This is a schematic diagram of the structure of a model determination device provided in Embodiment 3 of the present invention. Figure 3As shown, the device includes: a model determination module 31, an information determination module 32, an operator determination module 33 and an operator replacement module 34.

[0092] A model determination module 31 is used to obtain the model to be replaced and the operator support library of the target platform, where the target platform is the platform to which the model to be converted is to be converted;

[0093] An information determination module 32, configured to analyze the characteristics of each operator to be replaced contained in the model to be replaced, and determine operator-related information of each operator to be replaced;

[0094] An operator determination module 33 is used to perform similarity matching in the operator support library based on the relevant information of each operator to obtain a target operator that matches the operator to be replaced;

[0095] The operator replacement module 34 is used to replace the operator to be replaced based on the target operator to obtain a target model adapted to the target platform.

[0096] The technical solution of the embodiment of the present invention is to obtain the operator support library of the model to be replaced and the target platform, wherein the target platform is the platform to which the model to be converted is to be converted; the characteristics of each operator to be replaced contained in the model to be replaced are analyzed to determine the operator-related information of each operator to be replaced; based on the relevant information of each operator, similarity matching is performed in the operator support library to obtain a target operator matching the operator to be replaced; based on the target operator, the operator to be replaced is replaced to obtain a target model adapted to the target platform. By analyzing the characteristics of the operator, the operator-related information is obtained, and based on the operator-related information, the operator support library pre-built for the target platform is analyzed and compared to determine the similarity with the operator to be replaced, thereby finding the optimal target operator, enhancing the rationality of operator replacement, and being able to more efficiently screen out the most suitable operator replacement scheme.

[0097] Furthermore, the operator determination module includes:

[0098] A first determining unit, configured to screen a candidate operator set from the operator support library according to a basic attribute vector in the operator characteristic vector for each of the operators to be replaced;

[0099] A second determining unit, configured to determine a similarity between the operator to be replaced and each candidate operator in the candidate operator set based on the operator context relationship, the operator characteristic vector and the candidate operator set;

[0100] The third determining unit is configured to select a target operator matching the operator to be replaced from the candidate operator set based on the similarities.

[0101] The operator characteristic vector includes: a static characteristic sub-vector, a dynamic characteristic sub-vector, a calculation path sub-vector and a topological characteristic sub-vector.

[0102] Wherein, the second determining unit includes:

[0103] A coefficient acquisition subunit, used to acquire context weight coefficients and operator weight coefficients;

[0104] A first determining subunit, configured to determine, based on the operator context relationship, a set of context operators adjacent to the operator to be replaced in the model to be replaced, wherein the set of context operators includes the operator to be replaced, a preceding operator adjacent to the operator to be replaced, and a following operator;

[0105] The second determining subunit is used to determine the similarity between the operator to be replaced and each candidate operator in the candidate operator set according to the context operator set, the context weight coefficient, the operator weight coefficient and the candidate operator set.

[0106] Wherein, the second determining subunit is specifically used for:

[0107] Determining context operator similarity according to the context operator set and the candidate characteristic vector of each candidate operator in the candidate operator set;

[0108] Determining operator similarity according to the operator characteristic vector and each of the candidate characteristic vectors;

[0109] The context operator similarity is weighted based on the context weight coefficient, and the operator similarity is weighted based on the operator weight coefficient to obtain the similarity between the operator to be replaced and each candidate operator in the candidate operator set.

[0110] Furthermore, the operator determination module is also used for:

[0111] The operator related information includes an operator characteristic vector and a weighting factor; the operator characteristic vector includes at least two characteristic sub-vectors, and the sub-similarity of the characteristic sub-vectors is determined according to the operator characteristic vector and the supporting operator characteristic vectors of each supporting operator in the operator support library;

[0112] Weighting the sub-similarity according to the weighting factor to obtain a total similarity;

[0113] Based on the total similarities, a target operator matching the operator to be replaced is screened from the candidate operator set.

[0114] The model determination device provided in the embodiment of the present invention can execute the model determination method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0115] Embodiment 4

[0116] Figure 4 A schematic diagram of the structure of an electronic device 40 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0117] like Figure 4 As shown, the electronic device 40 includes at least one processor 41, and a memory connected to the at least one processor 41, such as a read-only memory (ROM) 42, a random access memory (RAM) 43, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 41 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 42 or the computer program loaded from the storage unit 48 to the random access memory (RAM) 43. In the RAM 43, various programs and data required for the operation of the electronic device 40 can also be stored. The processor 41, the ROM 42, and the RAM 43 are connected to each other through a bus 44. An input / output (I / O) interface 45 is also connected to the bus 44.

[0118] A number of components in the electronic device 40 are connected to the I / O interface 45, including: an input unit 46, such as a keyboard, a mouse, etc.; an output unit 47, such as various types of displays, speakers, etc.; a storage unit 48, such as a disk, an optical disk, etc.; and a communication unit 49, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 49 allows the electronic device 40 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0119] The processor 41 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 41 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The processor 41 performs the various methods and processes described above, such as the model determination method.

[0120] In some embodiments, the model determination method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 48. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 40 via the ROM 42 and / or the communication unit 49. When the computer program is loaded into the RAM 43 and executed by the processor 41, one or more steps of the model determination method described above may be performed. Alternatively, in other embodiments, the processor 41 may be configured to perform the model determination method in any other appropriate manner (e.g., by means of firmware).

[0121] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0122] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0123] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0124] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0125] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0126] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0127] In one embodiment, the present invention further includes a computer program product, the computer program product includes a computer program, and the computer program implements the model determination method of any embodiment of the present invention when executed by a processor.

[0128] In the process of implementation, the computer program product can be written in one or more programming languages ​​or a combination thereof to perform the computer program code of the present invention, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).

[0129] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0130] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A model determination method, characterized in that: include: Obtaining the operator support library of the model to be replaced and the target platform, wherein the target platform is the platform to which the model to be converted is to be converted; Analyze the characteristics of each operator to be replaced contained in the model to be replaced, and determine operator-related information of each operator to be replaced; Based on the relevant information of each operator, similarity matching is performed in the operator support library to obtain a target operator that matches the operator to be replaced; The operator to be replaced is replaced based on the target operator to obtain a target model adapted to the target platform.

2. The method according to claim 1, characterized in that The operator related information includes an operator characteristic vector and an operator context relationship. Accordingly, based on the operator related information, similarity matching is performed in the operator support library to obtain a target operator matching the operator to be replaced, including: For each of the operators to be replaced, a candidate operator set is screened from the operator support library according to the basic attribute vector in the operator characteristic vector; Determining the similarity between the operator to be replaced and each candidate operator in the candidate operator set based on the operator context relationship, the operator characteristic vector and the candidate operator set; Based on the similarities, a target operator matching the operator to be replaced is selected from the candidate operator set.

3. The method according to claim 2, characterized in that The determining, based on the operator context relationship, the operator characteristic vector and the candidate operator set, the similarity between the operator to be replaced and each candidate operator in the candidate operator set includes: Get context weight coefficient and operator weight coefficient; Based on the operator context relationship, determining a set of context operators adjacent to the operator to be replaced in the model to be replaced, wherein the set of context operators includes the operator to be replaced, a preceding operator adjacent to the operator to be replaced, and a following operator; The similarity between the operator to be replaced and each candidate operator in the candidate operator set is determined according to the context operator set, the context weight coefficient, the operator weight coefficient and the candidate operator set.

4. The method according to claim 3, characterized in that The determining, according to the context operator set, the context weight coefficient, the operator weight coefficient and the candidate operator set, the similarity between the operator to be replaced and each candidate operator in the candidate operator set includes: Determining context operator similarity according to the context operator set and the candidate characteristic vector of each candidate operator in the candidate operator set; Determining operator similarity according to the operator characteristic vector and each of the candidate characteristic vectors; The context operator similarity is weighted based on the context weight coefficient, and the operator similarity is weighted based on the operator weight coefficient to obtain the similarity between the operator to be replaced and each candidate operator in the candidate operator set.

5. The method according to claim 2, characterized in that: The operator characteristic vector includes: a static characteristic sub-vector, a dynamic characteristic sub-vector, a calculation path sub-vector and a topological characteristic sub-vector.

6. The method according to claim 1, characterized in that The operator related information includes an operator characteristic vector and a weighting factor. Accordingly, based on the operator related information, similarity matching is performed in the operator support library to obtain a target operator matching the operator to be replaced, including: The operator characteristic vector includes at least two characteristic sub-vectors, and the sub-similarity of the characteristic sub-vectors is determined according to the operator characteristic vector and the supporting operator characteristic vectors of each supporting operator in the operator support library; Weighting the sub-similarity according to the weighting factor to obtain a total similarity; Based on the total similarities, a target operator matching the operator to be replaced is screened from the candidate operator set.

7. A model determination device, characterized in that: include: A model determination module, used to obtain the model to be replaced and the operator support library of the target platform, wherein the target platform is the platform to which the model to be converted is to be converted; An information determination module, used to analyze the characteristics of each operator to be replaced contained in the model to be replaced, and determine operator-related information of each operator to be replaced; An operator determination module, configured to perform similarity matching in the operator support library based on the relevant information of each operator, and obtain a target operator matching the operator to be replaced; An operator replacement module is used to replace the operator to be replaced based on the target operator to obtain a target model adapted to the target platform.

8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the model determination method according to any one of claims 1 to 6.

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 processor to implement the model determination method according to any one of claims 1 to 6 when executed.

10. A computer program product, characterized in that The computer program product comprises a computer program, which, when executed by a processor, implements the model determination method according to any one of claims 1 to 6.

Citation Information

Cited By

  • Task execution method, electronic equipment, storage medium and program product

    CN120671869A

  • Task execution methods, electronic devices, storage media, and program products

    CN120671869B

  • Migration operator generation method and device based on heterogeneous architecture and medium

    CN121935035A

  • A method, device and medium for generating a migration operator based on a heterogeneous architecture

    CN121935035B