Data processing method and data processing device for deep learning reasoning framework
By determining the data arrangement conversion strategy based on the input and output data dimensions of the inference operator, and only performing conversion when the data Rank changes, the performance loss problem caused by frequent data conversion in the existing technology is solved, and the performance of the deep learning inference framework is improved. and ease of maintenance.
Patent Information
- Application Number
- CN202110539151.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-18
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2041-05-18
AI Technical Summary
Existing deep learning inference frameworks require frequent data conversion when processing the layout of different neural network models, resulting in large performance losses, and the existing solutions are complex and difficult to maintain.
By determining the data arrangement conversion strategy based on the input and output data dimensions of the inference operator, data conversion is only performed in operators whose data Rank changes, reducing unnecessary data conversion operations.
It significantly improves the inference performance of the deep learning inference framework for different Layout models, simplifies data conversion logic, and reduces software development and maintenance costs.
Smart Images

Figure CN113269303B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of deep learning technology, and more specifically, to a data processing method and a data processing device for a deep learning reasoning framework. Background Art
[0002] With the widespread application of deep learning technology, neural network models with better performance and neural network model training frameworks and inference frameworks suitable for different scenarios continue to emerge. Figure 1 The deployment of the neural network model can be divided into two stages: in the first stage, the neural network model is trained based on the training framework using the powerful computing power of the server; in the second stage, the neural network model (original model) trained in the first stage is executed based on the inference framework on the mobile terminal or the server to achieve the corresponding task objectives.
[0003] The neural network model may include multiple operators, such as Figure 2 The neural network model includes an input layer (Input), an output layer (Output), a convolution layer (Conv), a connection layer (Contact), a depthwise separable convolution layer (DepthwiseConv), a reconstruction layer (Reshape), and a long short term memory (LSTM) neural network layer. Among them, operators can be divided into two categories: 1) related to the data arrangement (Layout), and its implementation can be divided into two data arrangements: NHWC and NCHW, where N represents the number, C represents the channel, H represents the height, and W represents the width. 2) Not related to Layout, the implementation of this type of operator has nothing to do with the data arrangement.
[0004] The current mainstream neural network model training framework supports different layouts due to their different software and hardware optimization solutions. Figure 1 , the NCHW arrangement represented by Caffe and PyTorch and the NHWC arrangement represented by Tensorflow, so that the operators of the trained neural network model have different Layout attributes.
[0005] In the process of performing reasoning based on the original model, the inference framework needs to create corresponding inference operators for different operators in the original model. Currently, due to the performance of hardware devices and the cost of software optimization, the underlying implementation of an inference operator of an inference framework usually only supports one Layout. Therefore, when the Layout of the operator of the neural network model is different from the Layout of the inference operator of the inference framework, additional data conversion operations need to be added.
[0006] In the current related technologies, there are two main data conversion schemes used in the inference phase: i) performing data conversion on each Layout-related operator; ii) traversing the topological results of the original model, dividing the original model into sub-blocks with different Layouts, and then inserting Layout conversion operators between blocks. However, the above two data conversion schemes still have a relatively large performance loss in the inference execution phase.
[0007] Therefore, how to provide a solution that can reduce the performance loss caused by data conversion has become an urgent problem that needs to be solved. Summary of the invention
[0008] The present disclosure provides a data processing method for a deep learning reasoning framework and a corresponding data processing device to at least solve the problems in the above-mentioned related technologies, or may not solve any of the above-mentioned problems.
[0009] According to one aspect of an exemplary embodiment of the present disclosure, a data processing method for a deep learning reasoning framework is provided, the data processing method comprising: in response to the reasoning framework not supporting the data arrangement of the reasoning model, determining a data arrangement conversion strategy for the input data and output data of the reasoning operator according to the dimensionality of the input data received by the reasoning operator and the dimensionality of the corresponding output data and the correlation between the reasoning operator and the data arrangement; converting the data arrangement of the input data of the reasoning operator and / or converting the data arrangement of the output data of the reasoning operator according to the determined conversion strategy. The present application provides a new method for determining a data arrangement conversion strategy for an reasoning operator based on the dimensionality of the input and output data of the reasoning operator.
[0010] Optionally, the method also includes: before inputting the input data into the first-level inference operator of the inference framework, performing pre-processing on the input data according to the dimension of the input data, wherein the pre-processing step includes: in response to the dimension of the input data being a preset dimension, converting the data arrangement mode of the input data into a data arrangement mode supported by the inference framework, wherein the preset dimension is determined based on the data arrangement mode supported by the inference framework and the data arrangement mode of the inference model.
[0011] Optionally, the method also includes: post-processing the data output from the last layer of inference operators of the inference framework according to the dimension of the data output from the last layer of inference operators of the inference framework, wherein the post-processing step includes: in response to the dimension of the data output from the last layer of inference operators of the inference framework being a preset dimension, converting the data arrangement mode of the data output from the last layer of inference operators of the inference framework into a data arrangement mode supported by the inference model.
[0012] Optionally, the step of determining a data arrangement conversion strategy for input data and output data of an inference operator includes: if the parameters of the inference operator are related to the data arrangement, the implementation of the inference operator is independent of the data arrangement, and the dimension of the input data received by the inference operator and the dimension of the corresponding output data only include the following four cases: receiving input data of a preset dimension and correspondingly outputting output data of a preset dimension, receiving input data of a non-preset dimension and correspondingly outputting output data of a non-preset dimension, receiving input data of a preset dimension and correspondingly outputting output data of a non-preset dimension, receiving input data of a non-preset dimension and correspondingly outputting output data of a preset dimension, then the conversion strategy of the inference operator is determined as follows: for the case of receiving input data of a preset dimension and correspondingly outputting output data of a non-preset dimension, converting the data arrangement mode of the input data input to the inference operator into the data arrangement mode of the inference model; for the case of receiving input data of a non-preset dimension and correspondingly outputting output data of a preset dimension, converting the data arrangement mode of the output data of the inference operator into the data arrangement mode supported by the inference framework. This application determines the conversion strategy of data arrangement based on the dimension of the input and output data of the reasoning operator. Since the data conversion operation only needs to appear in the operator whose data rank changes, and in the general neural network model, the number of operators whose data rank changes is far less than the above-mentioned Layout-related operators. Based on this, in the reasoning stage, the data conversion operations in the model can be significantly reduced, thereby improving the reasoning performance of the deep learning reasoning framework for different Layout models.
[0013] Optionally, the step of determining a data arrangement conversion strategy for the input data and output data of the inference operator also includes: if the parameters of the inference operator are related to the data arrangement, the implementation of the inference operator is independent of the data arrangement, and the dimension of the input data received by the inference operator and the dimension of the corresponding output data only include the following two situations: receiving input data of a preset dimension and correspondingly outputting output data of a preset dimension, and receiving input data of a non-preset dimension and correspondingly outputting output data of a non-preset dimension, then the conversion strategy of the inference operator is determined as: not converting the data arrangement mode of the input data and output data of the inference operator, but adjusting the parameters of the inference operator for the situation of receiving input data of a non-preset dimension and correspondingly outputting output data of a non-preset dimension.
[0014] Optionally, the step of determining a data arrangement conversion strategy for input data and output data of an inference operator includes: determining a data arrangement conversion strategy for input data and output data of an inference operator when executing the inference operator; or, determining a data arrangement conversion strategy for input data and output data of an inference operator before executing the inference operator.
[0015] Optionally, the preset dimension is 4, wherein the data arrangement mode of the reasoning model is NHWC and the data arrangement mode supported by the reasoning framework is NCWH, or the data arrangement mode of the reasoning model is NCWH and the data arrangement mode supported by the reasoning framework is NHWC.
[0016] According to another aspect of the exemplary embodiment of the present disclosure, there is provided a data processing device for a deep learning reasoning framework, the data processing device comprising: a conversion strategy determination unit, configured to: in response to the reasoning framework not supporting the data arrangement of the reasoning model, determine the data arrangement conversion strategy of the input data and output data of the reasoning operator according to the dimension of the input data received by the reasoning operator and the dimension of the corresponding output data and the correlation between the reasoning operator and the data arrangement; an execution unit, configured to: convert the data arrangement of the input data of the reasoning operator and / or convert the data arrangement of the output data of the reasoning operator according to the determined conversion strategy. The present application provides a new device for determining the data arrangement conversion strategy of the reasoning operator based on the dimension of the input and output data of the reasoning operator.
[0017] Optionally, the data processing device also includes: a pre-processing unit, configured to: before inputting the input data into the first-level inference operator of the inference framework, in response to the dimension of the input data being a preset dimension, convert the data arrangement mode of the input data into a data arrangement mode supported by the inference framework, wherein the preset dimension is determined based on the data arrangement mode supported by the inference framework and the data arrangement mode of the inference model.
[0018] Optionally, the data processing device also includes: a post-processing unit, configured to: in response to the dimension of the data output from the last layer of inference operators of the inference framework being a preset dimension, convert the data arrangement mode of the data output from the last layer of inference operators of the inference framework into a data arrangement mode supported by the inference model.
[0019] Optionally, the conversion strategy determination unit is configured as follows: if the parameters of the inference operator are related to the data arrangement mode, the implementation of the inference operator is independent of the data arrangement mode, and the dimension of the input data received by the inference operator and the dimension of the corresponding output data only include the following four situations: receiving input data of preset dimension and correspondingly outputting output data of preset dimension, receiving input data of non-preset dimension and correspondingly outputting output data of non-preset dimension, receiving input data of preset dimension and correspondingly outputting output data of non-preset dimension, receiving input data of non-preset dimension and correspondingly outputting output data of preset dimension, then the conversion strategy of the inference operator is determined as follows: for the case of receiving input data of preset dimension and correspondingly outputting output data of non-preset dimension, the data arrangement mode of the input data input to the inference operator is converted into the data arrangement mode of the inference model; for the case of receiving input data of non-preset dimension and correspondingly outputting output data of preset dimension, the data arrangement mode of the output data of the inference operator is converted into the data arrangement mode supported by the inference framework.
[0020] Optionally, the conversion strategy determination unit is also configured as follows: if the parameters of the reasoning operator are related to the data arrangement mode, the implementation of the reasoning operator is independent of the data arrangement mode, and the dimension of the input data received by the reasoning operator and the dimension of the corresponding output data only include the following two cases: receiving input data of preset dimensions and correspondingly outputting output data of preset dimensions, receiving input data of non-preset dimensions and correspondingly outputting output data of non-preset dimensions, then the conversion strategy of the reasoning operator is determined as follows: the data arrangement mode of the input data and output data of the reasoning operator is not converted, but the parameters of the reasoning operator are adjusted for the case of receiving input data of non-preset dimensions and correspondingly outputting output data of non-preset dimensions. The present application determines the conversion strategy of the data arrangement mode based on the dimension of the input and output data of the reasoning operator. Since the data conversion operation only needs to appear in the operator whose data Rank changes, and in the general neural network model, the number of operators whose data Rank changes is much smaller than the above-mentioned operators related to Layout. Based on this, in the reasoning stage, the data conversion operations in the model can be significantly reduced, thereby improving the reasoning performance of the deep learning reasoning framework for different Layout models.
[0021] Optionally, the conversion strategy determination unit is configured to: determine a data arrangement conversion strategy for the input data and output data of the inference operator when executing the inference operator; or determine a data arrangement conversion strategy for the input data and output data of the inference operator before executing the inference operator.
[0022] Optionally, the preset dimension is 4, the data arrangement mode of the reasoning model is NHWC, and the data arrangement mode supported by the reasoning framework is NCWH, or the data arrangement mode of the reasoning model is NCWH, and the data arrangement mode supported by the reasoning framework is NHWC.
[0023] According to another aspect of the exemplary embodiments of the present disclosure, there is provided a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the data processing method as described above is implemented.
[0024] According to another aspect of the exemplary embodiments of the present disclosure, there is provided an electronic device, comprising: at least one processor; and at least one memory storing computer executable instructions, wherein when the computer executable instructions are executed by the at least one processor, the at least one processor executes the data processing method as described above. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The above and other objects and features of the exemplary embodiments of the present disclosure will become more apparent through the following description in conjunction with the accompanying drawings which exemplarily illustrate the embodiments, in which:
[0026] Figure 1 is a flowchart showing an example of deep learning task deployment in the related art;
[0027] Figure 2 is a schematic diagram showing an example of a neural network model in the related art;
[0028] Figure 3 is a schematic diagram showing a first data transformation scheme adopted in the inference phase;
[0029] Figure 4 is a schematic diagram showing a second data transformation scheme adopted in the inference phase;
[0030] Figure 5 is a flow chart illustrating a data processing method for a deep learning reasoning framework according to an embodiment of the present disclosure;
[0031] Figure 6 is a block diagram illustrating a data processing device for a deep learning reasoning framework according to an embodiment of the present disclosure;
[0032] Figure 7 is a diagram showing an example of a structure for a deep learning reasoning framework according to an embodiment of the present disclosure;
[0033] Figure 8 is a flow chart showing a method for executing data arrangement mode conversion according to an embodiment of the present disclosure;
[0034] Fig. 9 is a schematic diagram showing an example of a data processing method for a deep learning reasoning framework according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0035] The following specific embodiments are provided to help the reader obtain a comprehensive understanding of the methods, devices and / or systems described herein. However, after understanding the disclosure of the present application, various changes, modifications and equivalents of the methods, devices and / or systems described herein will be clear. For example, the order of operations described herein is only an example and is not limited to those orders set forth herein, but can be changed as will be clear after understanding the disclosure of the present application, except for operations that must occur in a specific order. In addition, for greater clarity and simplicity, the description of features known in the art may be omitted.
[0036] The features described herein can be implemented in different forms and should not be construed as being limited to the examples described herein. Rather, the examples described herein have been provided to illustrate only some of the many possible ways to implement the methods, devices, and / or systems described herein, which will be clear after understanding the disclosure of the present application.
[0037] The terms used herein are only used to describe various examples and are not intended to limit the disclosure. Unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. The terms "comprise", "include" and "have" indicate the presence of the described features, quantities, operations, components, elements and / or combinations thereof, but do not exclude the presence or addition of one or more other features, quantities, operations, components, elements and / or combinations thereof.
[0038] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as those generally understood by a person of ordinary skill in the art to which the present disclosure belongs after understanding the present disclosure. Unless explicitly defined as such herein, terms (such as those defined in a general dictionary) should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and the present disclosure, and should not be interpreted in an idealized or overly formal manner.
[0039] Furthermore, in the description of examples, when it is considered that a detailed description of a well-known related structure or function would cause vague interpretation of the present disclosure, such a detailed description will be omitted.
[0040] In order to solve the technical problems mentioned in the above background technology section, the inventors of the present disclosure have repeatedly studied the relevant technologies and found the causes of the above technical problems, which are as follows:
[0041] Regarding the data conversion operation scheme i) adopted in the related art:
[0042] Reference Figure 3 , the inference operator of the inference framework supports NCHW Layout, while the original model (neural network model) supports NHWC Layout. Therefore, data conversion needs to be performed in each operator related to Layout.
[0043] When the inference framework performs inference on the original model, it is necessary to create operators based on the structural information of the original model to perform inference calculations. During the inference execution phase, the layout of the data passed between the created inference operators needs to be consistent with the layout supported by the original model (i.e., the neural network model). In this way, if the layout of the data passed between the inference operators is inconsistent with the layout supported by the original model, data conversion is required during the internal calculation of the inference operator.
[0044] Reference Figure 3 , where the operators related to Layout include the convolution layer (Conv) and the depthwise separable convolution layer (DepthwiseConv). During the execution of each corresponding inference operator, three steps need to be implemented: 1) convert the Layout of the input data from NHWC to NCHW; 2) perform calculations, 3) convert the Layout of the output data from NCHW to NHWC to pass it to the next layer of operators.
[0045] Since solution i) performs data conversion on each Layout-related operator, based on the above analysis, when the original model contains N Layout-related operators, 2*N data conversions need to be performed during the inference phase. This type of operator usually accounts for a high proportion in a neural network model, so the number of data conversions will increase linearly with the increase in the depth of the original model, resulting in a large performance loss for the original model during the inference phase.
[0046] For the scheme ii) of the data conversion operation adopted in the related art:
[0047] Reference Figure 4 , the Layout supported by the inference operator of the inference framework is NCHW, while the Layout supported by the original model (neural network model) is NHWC, so data conversion needs to be performed on the operators related to Layout in the inference stage.
[0048] However, the difference between solution ii) and solution i) is that before the inference framework performs inference on the original model, the topological structure of the original model is traversed, the original model is divided into sub-blocks with different layouts, and then the layout conversion operator is inserted between the blocks. Figure 4, divide the original model into Block0 and Block1, and then insert the conversion operator between Block0 and Block1 to convert the data layout from NCHW to NHWC. Insert the conversion operator between the input and Block0 to convert the data layout from NHWC to NCHW.
[0049] Although solution ii) can significantly reduce the number of data conversions, thereby reducing some performance losses in the model reasoning process. However, analysis of solution ii) shows that before the reasoning framework performs reasoning on the original model, it traverses the topology of the original model and determines the Layout attributes of each operator and related operators. This has complex software implementation logic, which affects the maintainability and flexibility of the software. In addition, as the topology of the neural network model becomes increasingly complex, the time and space complexity of graph traversal increases, which brings additional performance loss and power consumption burden to the reasoning execution process.
[0050] Based on the above reasons, the inventors thought that when the reasoning framework performs reasoning on the original model, the number of data conversions should be reduced while avoiding the introduction of graph traversal, so as to reduce the performance loss in the reasoning stage to a certain extent. Based on this idea, the inventors found after repeated research that:
[0051] The operators related to Layout in the neural network model must have the characteristic that the dimension (Rank) of the input and output data is 4. Therefore, Rank information can be considered as the main basis for judging the conversion of data arrangement. Specifically, the data with Rank 4 can be given the Layout attributes supported by the reasoning operator of the reasoning framework (for example, NCHW or NHWC). Then, the data with Rank not 4 maintains the same Layout attributes as the original model. Therefore, the data conversion operation only needs to appear in the operators whose data Rank changes, and the number of such operators whose Rank changes is much smaller than the above-mentioned operators related to Layout. Based on this, in the reasoning stage, the data conversion operations in the model can be significantly reduced, thereby improving the reasoning performance of the deep learning reasoning framework for different Layout models. In addition, there is no need to perform graph traversal and graph segmentation operations, which significantly simplifies the judgment logic of data conversion, thereby saving software development and maintenance costs.
[0052] In view of this, according to one aspect of an exemplary embodiment of the present disclosure, a data processing method for a deep learning reasoning framework is provided. Figure 5 is a flow chart showing a data processing method for a deep learning reasoning framework according to an embodiment of the present disclosure. Figure 5 , the data processing method includes step S501 to step S502.
[0053] In step S501, in response to the inference framework not supporting the data arrangement mode of the inference model, a data arrangement mode conversion strategy for the input data and output data of the inference operator is determined according to the dimension of the input data received by the inference operator and the dimension of the corresponding output data and the correlation between the inference operator and the data arrangement mode.
[0054] In step S502, the data arrangement of the input data of the inference operator is converted according to the determined conversion strategy, and / or the data arrangement of the output data of the inference operator is converted.
[0055] As an example, before inputting the input data into the first-level inference operator of the inference framework, if the inference framework does not support the data arrangement mode of the inference model, pre-processing is performed on the input data according to the dimension of the input data, wherein the pre-processing step includes: in response to the dimension of the input data being a preset dimension, converting the data arrangement mode of the input data into a data arrangement mode supported by the inference framework.
[0056] As an example, the preset dimension is determined according to the data arrangement mode supported by the reasoning framework and the data arrangement mode of the reasoning model.
[0057] Taking the case where the reasoning framework supports NCHW, and the reasoning model supports NHWC as an example, since the rank of NHWC and NCHW is 4, the dimension of the data based on the NHWC and NCHW formats is 4, and the preset dimension is determined to be 4, the pre-processing step includes: before inputting the data into the first-level reasoning operator, in response to the dimension of the input data being 4, converting the data arrangement NHWC of the input data into the data arrangement NCHW supported by the reasoning framework. If the dimension of the input data is not 4, the arrangement of the input data is not converted in the pre-processing step.
[0058] As an example, the data output from the last layer of inference operators of the inference framework may be post-processed according to the dimension of the data output from the last layer of inference operators of the inference framework, wherein the post-processing step includes: in response to the dimension of the data output from the last layer of inference operators of the inference framework being a preset dimension, converting the data arrangement mode of the data output from the last layer of inference operators of the inference framework into a data arrangement mode supported by the inference model.
[0059] Specifically, taking the case where the reasoning framework supports NCHW, and the reasoning model supports NHWC as an example, the post-processing step includes: in response to the dimension of the data output from the last layer of the reasoning operator of the reasoning framework being 4, converting the data arrangement mode NCWH of the data output from the last layer of the reasoning operator of the reasoning framework to the data arrangement mode NHWC supported by the reasoning model. In addition, if the dimension of the data output from the last layer of the reasoning operator of the reasoning framework is not 4, there is no need to convert the data arrangement mode of the output data.
[0060] As an example, the step of determining a data arrangement conversion strategy for input data and output data of an inference operator includes: if the parameters of the inference operator are related to the data arrangement, the implementation of the operator is independent of the data arrangement, and the dimension of the input data received by the inference operator and the dimension of the corresponding output data only include the following four cases:
[0061] 1. Receive input data of a preset dimension and output output data of a preset dimension accordingly;
[0062] 2. receiving input data of non-preset dimensions and correspondingly outputting output data of non-preset dimensions;
[0063] 3. Receive input data of preset dimensions and correspondingly output output data of non-preset dimensions;
[0064] 4. Receive input data of non-preset dimensions and output output data of preset dimensions accordingly;
[0065] Then the conversion strategy of the inference operator is determined as:
[0066] For Case 1 and Case 2, the data arrangement of the input data and the output data is not converted.
[0067] For case 3, the data arrangement of the input data input to the inference operator is converted into the data arrangement of the inference model;
[0068] For case 4, the data arrangement of the output data of the inference operator is converted into a data arrangement supported by the inference framework.
[0069] The step of determining the data arrangement mode conversion strategy of the input data and output data of the inference operator according to the dimensions of the input data and output data of the inference operator also includes: if the parameters of the inference operator are related to the data arrangement mode, the implementation of the operator is independent of the data arrangement mode, and the dimensions of the input data received by the inference operator and the dimensions of the corresponding output data only include the following two cases:
[0070] Case 1: receiving input data of a preset dimension and correspondingly outputting output data of a preset dimension;
[0071] Case 2: receiving input data of non-preset dimensions and correspondingly outputting output data of non-preset dimensions; then the conversion strategy of the inference operator is determined as:
[0072] For case 1, there is no need to transform the arrangement of input data and output data, nor to adjust the parameters of the inference operator.
[0073] For case 2, the data arrangement of the input data and output data of the inference operator is not converted, and the parameters of the inference operator are adjusted.
[0074] Specifically, taking the case where the reasoning framework supports NCHW, and the reasoning model supports NHWC as an example, if the implementation of the reasoning operator (i.e., the software implementation of the reasoning operator), the parameters of the reasoning operator, and the data supported by the reasoning model corresponding to the reasoning operator are all related to Layout and the reasoning operator can only receive 4-dimensional input data and output 4-dimensional output data accordingly, then the conversion strategy for such a reasoning operator (hereinafter referred to as a type A operator) is determined as follows: do not convert the data arrangement of the input data and the output data; if the parameters of the reasoning operator are related to the data arrangement, the implementation of the reasoning operator is not related to the data arrangement, and the input data received by the reasoning operator and the corresponding output The output data only includes the following two cases: receiving 4-dimensional output data and correspondingly outputting 4-dimensional output data (hereinafter referred to as B1 case), receiving non-4-dimensional input data and correspondingly outputting non-4-dimensional output data (hereinafter referred to as B2 case), then the conversion strategy for such inference operators (hereinafter referred to as B-type operators) is determined as follows: no data arrangement conversion is performed on the input data and output data, but for the B1 case, the parameters of the inference operator need to be adjusted; if the implementation of the inference operator, the parameters of the inference operator, and the data stored in the inference model corresponding to the inference operator are all unrelated to Layout, and the inference operator can only receive non-4-dimensional input data and correspondingly output non-4 dimensional output data, then the conversion strategy of such an inference operator (hereinafter referred to as a C-type operator) is determined as follows: the data arrangement mode of the input data and the output data is not converted, and the parameters of the inference operator are not adjusted; if the parameters of the inference operator are related to the data arrangement mode, the implementation of the operator is independent of the data arrangement mode, and the input data received by the inference operator and the corresponding output data only include the following four cases: receiving 4-dimensional input data and correspondingly outputting 4-dimensional output data (hereinafter referred to as the D1 case), receiving non-4-dimensional input data and correspondingly outputting non-4-dimensional output data (hereinafter referred to as the D2 case), receiving 4-dimensional input data and correspondingly outputting non-4-dimensional input data. Output data (hereinafter referred to as D3 situation), receive non-4D input data and output 4D output data accordingly (hereinafter referred to as D4 situation), then determine the conversion strategy of such inference operator (hereinafter referred to as D-type operator) as follows: for D1 situation and D2 situation, do not perform data arrangement conversion on input data and output data, and do not adjust the parameters of the inference operator; for D3 situation, convert the data arrangement NCHW of the input data input to the inference operator into the data arrangement NHWC of the inference model, and for D4 situation, convert the data arrangement NHWC of the output data of the inference operator into the data arrangement NCHW supported by the inference framework. Those skilled in the art should understand that this embodiment takes the case where the inference framework supports NCHW, while the inference model supports NHWC as an example for the purpose of illustration only, and does not limit the present disclosure.As an example, when executing an inference operator, a data arrangement conversion strategy for the input data and output data of the inference operator may be determined. That is, when a certain inference operator is executed, the conversion strategy of the inference operator is determined, and then the arrangement of the data is converted based on the conversion strategy. For example, the conversion strategy of one layer of inference operators may be determined each time a layer of inference operators is executed.
[0075] As an example, a data arrangement conversion strategy for input data and output data of an inference operator may be determined before executing the inference operator. That is, the conversion strategy for the inference operator may be determined in advance before the inference operator is executed, for example, the conversion strategy for each inference operator may be determined when parsing the inference model.
[0076] Those skilled in the art should understand that the embodiments of this document take the case where the reasoning framework supports NCWH and the reasoning model supports NHW as an example, which is only for the purpose of illustration and does not limit the present disclosure.
[0077] In addition, it should be noted that the neural network model can be trained by a training framework, and the initial neural network model is subjected to a preset number of supervised iterations based on the training data set to optimize the model parameters and obtain the final neural network model.
[0078] As an example, during the initialization phase of the inference model, the dimensions of the input data received by the inference operator and the dimensions of the corresponding output data as well as the correlation between the inference operator and the data arrangement method (i.e., the parameters of the operator, the implementation of the operator, and the correlation between the data stored in the inference model corresponding to the inference operator and the Layout) can be obtained.
[0079] Those skilled in the art should understand that the operator parameters described in this article refer to the parameter information required in the operator calculation process, such as the weight and PAD of the convolution; the implementation of the operator refers to the software implementation method of the operator, such as the convolution including GEMM, DEIRECT and other methods; the data of the operator refers to the input data and output data processed by the operator.
[0080] For example, as an optional implementation, the category of the operator may be determined based on the dimensions of the input data and output data of the reasoning operator and / or the correlation between the reasoning operator and the Layout, and then the conversion strategy of the reasoning operator may be determined based on the operator category.
[0081] As an example, operators can be classified into Class A operators, Class B operators, Class C operators, and Class D operators according to the classification rules described above. Then, the conversion strategy of the operator's data arrangement method is determined according to the operator category. Table 1 shows the Layout-related characteristics and examples of operators of different categories. Referring to Table 1, "the input data dimension and output data dimension of the operator" are the data Rank dimensions shown in Table 1, where M and N are both positive integers.
[0082] Table 1. Relevant characteristics and examples of different types of operators
[0083]
[0084] As can be understood, since the training framework directly trains the neural network model, when it is sent to the inference framework, the model parameters are the parameters of the operators at each layer. If inference is to be performed, the inference framework needs to create corresponding inference operators based on the parameters of the operators at each layer. For example, if an operator in the neural network model performs addition, then the inference framework can create a corresponding inference operator based on the parameters of the addition operator, and the inference operator can specifically perform the steps of the addition operation. Optionally, refer to Figure 7 The schematic diagram of the structure of the deep learning reasoning framework adopted by the present disclosure is shown. The above process of creating a corresponding category of reasoning operators for each operator can be performed in the initialization stage. In addition, in the initialization stage, in addition to the above-mentioned parsing model and creating reasoning operators, operations such as allocating memory and converting constant data can also be included.
[0085] Optionally, the data processing method of the present disclosure may further include: performing model conversion on the acquired neural network model trained by different training frameworks. Figure 7 Before initialization, the obtained neural network model is converted, and the model conversion may be, for example, adjusting the model parameters to improve the reasoning performance of the reasoning framework. The different training frameworks may be, for example, Caffe, PyTorch or Tensorflow.
[0086] Continue to refer to Figure 7 The reasoning framework can use hardware with different configurations to implement reasoning calculations according to the situation. The hardware can be, for example, NPU, GPU, DSP or CPU. Specifically, the reasoning stage can be divided into a "pre-processing" stage, an execution stage and a "post-processing" stage. The pre-processing stage processes the input data according to the pre-processing steps described above, the execution stage reasoning operators convert the input data or output data according to their respective conversion strategies, and the post-processing stage processes the data output by the last layer of operators according to the post-processing steps described above. Since it has been explained in detail above, it will not be repeated here.
[0087] As can be understood, for the case where the reasoning framework supports NCWH and the reasoning model supports NHWC, based on the description of the concept of the present invention in the aforementioned part, "the operators related to Layout in the network model must have the characteristic that the dimension (Rank) of the input and output data is 4. Therefore, Rank information can be considered as the main basis for judging the data conversion position. Specifically, the data with Rank 4 can be given the Layout attributes supported by the reasoning operator of the reasoning framework (for example, NCHW or NHWC), and then the Layout attributes of the data with Rank not 4 are maintained the same as those of the original model. Therefore, the data conversion operation only needs to appear in the operator whose data Rank changes, and in the general neural network model, the number of operators whose data Rank changes is much smaller than the above-mentioned Layout-related operators. Based on this, in the reasoning stage, the data conversion operations in the model can be significantly reduced, thereby improving the reasoning performance of the deep learning reasoning framework for deep learning models with different Layouts. In addition, there is no need to perform graph traversal and graph segmentation operations, which significantly simplifies the judgment logic of data conversion, thereby saving software development and maintenance costs."
[0088] According to an embodiment of the present disclosure, before an operator is executed, its input data arrangement has been converted into a preset data arrangement supported by the inference framework through a pre-processing step (corresponding to the first-layer operator) or its previous operator.
[0089] For ease of understanding, refer to Table 1 and Figure 8 , assuming that the Layout supported by the inference operator of the inference framework is NCHW arrangement, and the data arrangement supported by the inference model is NHWC arrangement:
[0090] For case B1, the data dimension of the input data and the output data is 4, and the pre-processing only needs to adjust the parameters of the inference operator and then perform the inference calculation.
[0091] As an example, for the B1 case, the parameters that need to be adjusted may depend on the situation. For example, for the inference operator corresponding to the connection layer operator, the adjusted relevant parameter may be the axis in the NCHW arrangement; for the inference operator corresponding to the convolution layer operator, the adjusted relevant parameter may be the weight.
[0092] For case B2, no parameters need to be adjusted in pre-processing, and the inference calculation can be performed directly.
[0093] For type C inference operators, no transformation is required on the arrangement of the data.
[0094] For the D1 case, there is no need to convert the data arrangement; for the D2 case, there is no need to convert the data arrangement.
[0095] For the D3 case, in response to the data dimension of the received input data being 4, the received input data is converted from an NCHW arrangement to an NHWC arrangement; for the D4 case, in response to the data dimension of the received input data being any positive integer except 4, the output data obtained after calculation by the inference operator is converted from an NHWC arrangement to an NCHW arrangement.
[0096] As can be understood, performing conversion on the received input data may correspond to the D3 case in the aforementioned D-type operator, that is, for the D3 case, the data received from the previous layer of inference operators is converted and then input to the current layer of inference operators for calculation. Performing conversion on the output data obtained after inference calculation may correspond to the D4 case in the D-type operator, that is, after the arrangement of the data output by the current layer of inference operators is converted, the converted data is transmitted to the next layer. Figure 8 For example, the reasoning operator of the reasoning framework supports NCHW layout, while the reasoning model supports NHWC data arrangement. In the "pre-processing" stage, it can be determined whether the Rank of the input data is equal to 4. If so, the data layout is converted from NHWC to NCHW; if not, it is not converted.
[0097] In the "execution" stage, operators 0 to 3 may all be inference operators, wherein operator 1 may be an inference operator corresponding to a class B operator, and operator 3 may be an inference operator corresponding to a class D operator.
[0098] In the "post-processing" stage, it can be determined whether the data dimension of the output data of the inference model is equal to 4. If so, data conversion is performed to convert the layout of the output data from NCHW arrangement to NHWC arrangement. If not, no conversion is performed.
[0099] Combine the following Fig. 9 The working process of the data processing method disclosed in the present invention is described as follows:
[0100] Reference Fig. 9 ,The Layout supported by the reasoning operator of the reasoning framework is NCHW arrangement, while the Layout supported by the reasoning model is NWHC arrangement.
[0101] In the initialization phase, the inference framework can determine the categories of each operator in the original model and the supported input and output data Rank based on the analysis of the original model (neural network model), and then create the corresponding inference operators and allocate memory to establish the inference model. The constant data in the original model can also be converted from NHWC arrangement to NCHW arrangement, where the constant data includes the weight data of Conv and DepthwiseConv, thereby saving some conversion overhead for the inference process.
[0102] In the pre-processing stage, the Rank of the input data is 4, and the Layout of the input data is converted from NHWC to NCHW arrangement.
[0103] In the execution phase, the inference operator corresponding to the A-type operator (for example, Conv, DepthwiseConv) does not need to perform data conversion and can directly calculate. The operator corresponding to the B-type operator (for example, Concat) only needs to adjust the parameters and then perform the inference calculation. The Reshape inference operator corresponding to the D-type operator needs to perform data conversion because its input data Rank = 4 and output data Rank = 3, that is, the input and output data Ranks are different. Specifically, the input data Layout is converted from NCHW to NHWC. The inference operator corresponding to the C-type operator LSTM is independent of its implementation data Layout and the input and output data Ranks are both 3, so the inference calculation can be directly performed.
[0104] In the post-processing stage, since the Rank of the output data is 3, no conversion is required and it is directly output.
[0105] When the Layout supported by the reasoning operator of the reasoning framework is NHWC arrangement, and the reasoning model supports NCWH, the opposite conversion logic can be adopted, that is, the operation of converting NCWH to NHWC is changed to the operation of converting NHWC to NCWH, and the operation of converting NHWC to NCWH is changed to the operation of converting NCWH to NHWC. In summary, using the data processing method disclosed in the present invention, in the initialization stage, the reasoning framework can determine the category of each operator in the original model and the supported input and output data Rank based on the analysis of the original model (neural network model), and then create a corresponding reasoning operator to establish an inference model; in the pre-processing stage, the input data with Rank 4 is given the preset Layout attribute supported by the reasoning framework, and the data stream with Rank not 4 maintains the same Layout attribute as the original model; so that in the reasoning stage, the data conversion operation only needs to appear in the reasoning operator whose data Rank changes, which significantly reduces the data conversion operation in the reasoning model, thereby improving the reasoning performance of the deep learning reasoning framework for different Layout deep learning models. At the same time, the present invention does not need to perform graph traversal and graph segmentation operations, which significantly simplifies the judgment logic of data conversion, thereby saving software development and maintenance costs.
[0106] The data processing method for a deep learning reasoning framework according to an embodiment of the present disclosure is described in detail above. The data processing device for a deep learning reasoning framework according to an embodiment of the present disclosure will be described in detail below.
[0107] Reference Figure 6The data processing device 600 includes a conversion strategy determination unit 610 and a pre-processing execution unit 620. Those skilled in the art should understand that the data processing device 600 described in the present disclosure may further include other components.
[0108] As an example, the conversion strategy determination unit 610 can be configured to: in response to the inference framework not supporting the data arrangement of the inference model, determine the data arrangement conversion strategy of the input data and output data of the inference operator according to the dimension of the input data received by the inference operator and the dimension of the corresponding output data and the correlation between the inference operator and the data arrangement.
[0109] As an example, the execution unit 620 may be configured to: convert the data arrangement of the input data of the inference operator and / or convert the data arrangement of the output data of the inference operator according to the determined conversion strategy.
[0110] As an example, the data processing device 600 may also include a pre-processing unit (not shown), which may be configured to: before inputting the input data into the first-level inference operator of the inference framework, in response to the dimension of the input data being a preset dimension, convert the data arrangement mode of the input data into a data arrangement mode supported by the inference framework, wherein the preset dimension is determined based on the data arrangement mode supported by the inference framework and the data arrangement mode of the inference model.
[0111] As an example, the data processing device 600 may also include a post-processing unit (not shown), which may be configured to: in response to the dimension of the data output from the last layer of inference operators of the inference framework being a preset dimension, convert the data arrangement mode of the data output from the last layer of inference operators of the inference framework into a data arrangement mode supported by the inference model.
[0112] As an example, the conversion strategy determination unit 610 can be configured as follows: if the parameters of the inference operator are related to the data arrangement method, the implementation of the inference operator is independent of the data arrangement method, and the dimension of the input data received by the inference operator and the dimension of the corresponding output data only include the following four situations: receiving input data of preset dimension and correspondingly outputting output data of preset dimension, receiving input data of non-preset dimension and correspondingly outputting output data of non-preset dimension, receiving input data of preset dimension and correspondingly outputting output data of non-preset dimension, receiving input data of non-preset dimension and correspondingly outputting output data of preset dimension, then the conversion strategy of the inference operator is determined as follows: for the case of receiving input data of preset dimension and correspondingly outputting output data of non-preset dimension, the data arrangement method of the input data input to the inference operator is converted into the data arrangement method of the inference model; for the case of receiving input data of non-preset dimension and correspondingly outputting output data of preset dimension, the data arrangement method of the output data of the inference operator is converted into the data arrangement method supported by the inference framework.
[0113] As an example, the conversion strategy determination unit 610 can also be configured as follows: if the parameters of the inference operator are related to the data arrangement method, the implementation of the inference operator is independent of the data arrangement method, and the dimension of the input data received by the inference operator and the dimension of the corresponding output data only include the following two situations: receiving input data of a preset dimension and correspondingly outputting output data of a preset dimension, and receiving input data of a non-preset dimension and correspondingly outputting output data of a non-preset dimension, then the conversion strategy of the inference operator is determined as follows: the data arrangement method of the input data and output data of the inference operator is not converted, and the parameters of the inference operator are adjusted for the situation of receiving input data of a non-preset dimension and correspondingly outputting output data of a non-preset dimension.
[0114] As an example, the conversion strategy determination unit 610 is configured to: determine the data arrangement conversion strategy of the input data and output data of the reasoning operator when executing the reasoning operator; or determine the data arrangement conversion strategy of the input data and output data of the reasoning operator before executing the reasoning operator.
[0115] As an example, the preset dimension is 4, wherein the data arrangement mode of the reasoning model is NHWC and the data arrangement mode supported by the reasoning framework is NCWH, or the data arrangement mode of the reasoning model is NCWH and the data arrangement mode supported by the reasoning framework is NHWC.
[0116] It should be understood that each unit / module in the data processing device according to the exemplary embodiment of the present disclosure can be implemented as a hardware component and / or a software component. Those skilled in the art can implement each unit / module, for example, using a field programmable gate array (FPGA) or an application specific integrated circuit (ASIC), according to the processing performed by each defined unit / module.
[0117] According to still another aspect of the exemplary embodiments of the present disclosure, a computer-readable storage medium storing a computer program is provided, wherein when the computer program is executed by a processor, the data processing method of the present disclosure is implemented.
[0118] Specifically, the data processing method according to the exemplary embodiments of the present disclosure may be written as a computer program, a code segment, an instruction, or any combination thereof, and recorded, stored, or fixed in or on one or more non-transitory computer-readable storage media. The computer-readable storage medium is any data storage device that can store data read out by a computer system. Examples of computer-readable storage media include: read-only memory, random access memory, read-only optical disk, magnetic tape, floppy disk, optical data storage device, and carrier wave (such as data transmission through the Internet via a wired or wireless transmission path).
[0119] According to another aspect of the exemplary embodiments of the present disclosure, an electronic device is provided, wherein the electronic device includes: at least one processor; and at least one memory storing computer-executable instructions, wherein the computer-executable instructions, when executed by the at least one processor, enable the at least one processor to execute the data processing method described in the present disclosure.
[0120] Specifically, the electronic device can be broadly a tablet computer, a smart phone, a smart watch, or any other electronic device with necessary computing and / or processing capabilities. In one embodiment, the electronic device may include a processor, a memory, a network interface, a communication interface, etc. connected via a system bus. The processor of the electronic device can be used to provide necessary computing, processing and / or control capabilities. The memory of the electronic device may include a non-volatile storage medium and an internal memory. An operating system, a computer program, etc. may be stored in or on the non-volatile storage medium. The internal memory may provide an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface and the communication interface of the electronic device can be used to connect and communicate with external devices via a network.
[0121] In summary, using the data processing method or system disclosed in the present invention, in the initialization stage, the reasoning framework can determine the category of each operator in the original model and the supported input and output data Rank based on the analysis of the original model (neural network model), and then create the corresponding reasoning operator to establish the reasoning model; in the pre-processing stage, the input data with Rank 4 is given the preset Layout attribute supported by the reasoning model, and the data stream with Rank not 4 maintains the same Layout attribute as the original model; so that in the reasoning stage, the data conversion operation only needs to appear in the reasoning operator whose data Rank changes, which significantly reduces the data conversion operation in the reasoning model, thereby improving the reasoning performance of the deep learning reasoning framework for different Layout operators of the original model. At the same time, the present invention does not need to perform graph traversal and graph segmentation operations, which significantly simplifies the judgment logic of data conversion, thereby saving software development and maintenance costs.
[0122] Although some exemplary embodiments of the present disclosure have been shown and described, it will be appreciated by those skilled in the art that modifications may be made to these embodiments without departing from the principles and spirit of the present disclosure, the scope of which is defined by the claims and their equivalents.
Claims
1. A data processing method for deep learning inference framework, It is characterized in that The data processing method comprises: In response to the inference framework not supporting the data arrangement of the inference model, determining a data arrangement conversion strategy for the input data and output data of the inference operator according to the dimension of the input data received by the inference operator and the dimension of the corresponding output data and the correlation between the inference operator and the data arrangement; According to the determined conversion strategy, the data arrangement of the input data of the inference operator is converted, and / or the data arrangement of the output data of the inference operator is converted, The step of determining the data arrangement conversion strategy of the input data and output data of the inference operator includes: If the parameters of the inference operator are related to the data arrangement mode, the implementation of the inference operator is independent of the data arrangement mode, and the dimension of the input data received by the inference operator and the dimension of the corresponding output data only include the following four cases: receiving input data of preset dimension and correspondingly outputting output data of preset dimension, receiving input data of non-preset dimension and correspondingly outputting output data of non-preset dimension, receiving input data of preset dimension and correspondingly outputting output data of non-preset dimension, receiving input data of non-preset dimension and correspondingly outputting output data of preset dimension, then the conversion strategy of the inference operator is determined as: For a case where input data of a preset dimension is received and output data of a non-preset dimension is correspondingly outputted, a data arrangement mode of the input data input to the inference operator is converted into a data arrangement mode of the inference model; In the case of receiving input data of non-preset dimensions and correspondingly outputting output data of preset dimensions, the data arrangement mode of the output data of the inference operator is converted into a data arrangement mode supported by the inference framework.
2. The method according to claim 1, further comprising: include: Before inputting the input data into the first-level inference operator of the inference framework, pre-processing is performed on the input data according to the dimension of the input data. Among them, the pre-processing step includes: in response to the dimension of the input data being a preset dimension, converting the data arrangement mode of the input data into a data arrangement mode supported by the inference framework, wherein the preset dimension is determined according to the data arrangement mode supported by the inference framework and the data arrangement mode of the inference model.
3. The method according to claim 2, further comprising: include: According to the dimension of the data output from the last layer of the inference operator of the inference framework, the data output from the last layer of the inference operator of the inference framework is post-processed, Among them, the post-processing step includes: in response to the dimension of the data output from the last layer of inference operators of the inference framework being a preset dimension, converting the data arrangement mode of the data output from the last layer of inference operators of the inference framework into a data arrangement mode supported by the inference model.
4. The method according to claim 1, in, The step of determining a data arrangement conversion strategy for the input data and output data of the inference operator also includes: if the parameters of the inference operator are related to the data arrangement, the implementation of the inference operator is independent of the data arrangement, and the dimension of the input data received by the inference operator and the dimension of the corresponding output data only include the following two situations: receiving input data of a preset dimension and correspondingly outputting output data of a preset dimension, and receiving input data of a non-preset dimension and correspondingly outputting output data of a non-preset dimension, then the conversion strategy of the inference operator is determined as: not converting the data arrangement of the input data and output data of the inference operator, but adjusting the parameters of the inference operator for the situation of receiving input data of a non-preset dimension and correspondingly outputting output data of a non-preset dimension.
5. The method according to claim 1, in, The steps of determining the data arrangement conversion strategy of the input data and output data of the inference operator include: When executing the inference operator, determining a data arrangement conversion strategy for the input data and output data of the inference operator; Alternatively, a data arrangement conversion strategy for input data and output data of the inference operator is determined before executing the inference operator.
6. The method according to any one of claims 2 to 5, in, The default dimension is 4. The data arrangement mode of the inference model is NHWC, and the data arrangement mode supported by the inference framework is NCWH; or the data arrangement mode of the inference model is NCWH, and the data arrangement mode supported by the inference framework is NHWC.
7. A data processing device for a deep learning reasoning framework, It is characterized in that The data processing device comprises: A conversion strategy determination unit is configured to: in response to the inference framework not supporting the data arrangement of the inference model, determine a data arrangement conversion strategy for the input data and output data of the inference operator according to the dimension of the input data received by the inference operator and the dimension of the corresponding output data and the correlation between the inference operator and the data arrangement; An execution unit is configured to: convert the data arrangement of the input data of the reasoning operator and / or convert the data arrangement of the output data of the reasoning operator according to the determined conversion strategy, The conversion strategy determination unit is configured as follows: If the parameters of the inference operator are related to the data arrangement mode, the implementation of the inference operator is independent of the data arrangement mode, and the dimension of the input data received by the inference operator and the dimension of the corresponding output data only include the following four cases: receiving input data of preset dimension and correspondingly outputting output data of preset dimension, receiving input data of non-preset dimension and correspondingly outputting output data of non-preset dimension, receiving input data of preset dimension and correspondingly outputting output data of non-preset dimension, receiving input data of non-preset dimension and correspondingly outputting output data of preset dimension, then the conversion strategy of the inference operator is determined as: For a case where input data of a preset dimension is received and output data of a non-preset dimension is correspondingly outputted, a data arrangement mode of the input data input to the inference operator is converted into a data arrangement mode of the inference model; In the case of receiving input data of non-preset dimensions and correspondingly outputting output data of preset dimensions, the data arrangement mode of the output data of the inference operator is converted into a data arrangement mode supported by the inference framework.
8. The data processing device according to claim 7, further comprising: include: The pre-processing unit is configured to: before inputting the input data into the first-level inference operator of the inference framework, in response to the dimension of the input data being a preset dimension, convert the data arrangement mode of the input data into a data arrangement mode supported by the inference framework, wherein the preset dimension is determined based on the data arrangement mode supported by the inference framework and the data arrangement mode of the inference model.
9. The data processing apparatus according to claim 8, further comprising: include: The post-processing unit is configured to: in response to the dimension of the data output from the last layer of inference operators of the inference framework being a preset dimension, convert the data arrangement mode of the data output from the last layer of inference operators of the inference framework into a data arrangement mode supported by the inference model.
10. In the data processing device as described in claim 7, the conversion strategy determination unit is further configured to: if the parameters of the inference operator are related to the data arrangement method, the implementation of the inference operator is independent of the data arrangement method, and the dimension of the input data received by the inference operator and the dimension of the corresponding output data only include the following two situations: receiving input data of preset dimension and correspondingly outputting output data of preset dimension, receiving input data of non-preset dimension and correspondingly outputting output data of non-preset dimension, then the conversion strategy of the inference operator is determined as: not converting the data arrangement method of the input data and output data of the inference operator, but adjusting the parameters of the inference operator according to the situation of receiving input data of non-preset dimension and correspondingly outputting output data of non-preset dimension.
11. The data processing device according to claim 7, in, The conversion strategy determination unit is configured to: When executing the inference operator, determining a data arrangement conversion strategy for the input data and output data of the inference operator; Alternatively, a data arrangement conversion strategy for input data and output data of the inference operator is determined before executing the inference operator.
12. The data processing device according to any one of claims 7 to 11, in, The default dimension is 4. The data arrangement mode of the inference model is NHWC, and the data arrangement mode supported by the inference framework is NCWH; or the data arrangement mode of the inference model is NCWH, and the data arrangement mode supported by the inference framework is NHWC.
13. A computer-readable storage medium storing a computer program, It is characterized in that When the computer program is executed by a processor, the reasoning method according to any one of claims 1 to 6 is implemented.
14. An electronic device, It is characterized in that include: at least one processor; at least one memory storing computer executable instructions, Wherein, when the computer executable instructions are executed by the at least one processor, the at least one processor is prompted to perform the reasoning method according to any one of claims 1 to 6.
