WO2022109779A1 - Data processing method and related device - Google Patents
Data processing method and related device Download PDFInfo
- Publication number
- WO2022109779A1 WO2022109779A1 PCT/CN2020/131120 CN2020131120W WO2022109779A1 WO 2022109779 A1 WO2022109779 A1 WO 2022109779A1 CN 2020131120 W CN2020131120 W CN 2020131120W WO 2022109779 A1 WO2022109779 A1 WO 2022109779A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- value
- target
- feature
- data
- rank
- Prior art date
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 15
- 238000012545 processing Methods 0.000 claims abstract description 81
- 238000000034 method Methods 0.000 claims abstract description 56
- 230000015654 memory Effects 0.000 claims description 58
- 230000008569 process Effects 0.000 claims description 25
- 238000004590 computer program Methods 0.000 claims description 5
- 239000004744 fabric Substances 0.000 claims 1
- 238000013473 artificial intelligence Methods 0.000 abstract description 21
- 238000013528 artificial neural network Methods 0.000 description 23
- 230000006870 function Effects 0.000 description 23
- 238000004891 communication Methods 0.000 description 22
- 238000013135 deep learning Methods 0.000 description 13
- 238000010586 diagram Methods 0.000 description 12
- 238000009795 derivation Methods 0.000 description 11
- 230000001537 neural effect Effects 0.000 description 11
- 238000013527 convolutional neural network Methods 0.000 description 7
- 238000005457 optimization Methods 0.000 description 7
- 230000003287 optical effect Effects 0.000 description 6
- 230000004913 activation Effects 0.000 description 5
- 238000004422 calculation algorithm Methods 0.000 description 4
- 238000013461 design Methods 0.000 description 3
- 238000011161 development Methods 0.000 description 2
- 230000018109 developmental process Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000007726 management method Methods 0.000 description 2
- 239000011159 matrix material Substances 0.000 description 2
- 238000003058 natural language processing Methods 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 230000006403 short-term memory Effects 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 239000002699 waste material Substances 0.000 description 2
- OKTJSMMVPCPJKN-UHFFFAOYSA-N Carbon Chemical compound [C] OKTJSMMVPCPJKN-UHFFFAOYSA-N 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000013136 deep learning model Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 229910021389 graphene Inorganic materials 0.000 description 1
- 238000003709 image segmentation Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000012067 mathematical method Methods 0.000 description 1
- 210000002569 neuron Anatomy 0.000 description 1
- 230000008447 perception Effects 0.000 description 1
- 238000011176 pooling Methods 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 238000012549 training Methods 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
Definitions
- the present application relates to the field of communication technologies, and in particular, to a data processing method and related equipment.
- Artificial intelligence is a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
- artificial intelligence is a branch of computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that responds in a similar way to human intelligence.
- Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that the machines have the functions of perception, reasoning and decision-making.
- Research in the field of artificial intelligence includes robotics, natural language processing, computer vision, decision-making and reasoning, human-computer interaction, recommendation and search, and basic AI theory.
- an unknown dimension value is only represented by -1, and the range of the dimension value is represented by the maximum value and the minimum value, so as to complete the derivation of the shape of the output data.
- NN neural network
- the embodiments of the present application provide a data processing method and related equipment, which aim to fill in the blank that the target arrangement feature of target data cannot be determined when the rank is unknown or the rank is known but the dimension value of at least one dimension is unknown. .
- a first aspect of the embodiments of the present application provides a data processing method, the method may include: acquiring at least one piece of input information, wherein each input information is used to represent an arrangement feature of target data, and the arrangement feature includes a first feature, the value of the first feature is the first value or the value of the first feature is the second value, the first value is used to represent the rank of the unknown target data, and the second value is used to represent the rank of the known target data and unknown
- the dimension value corresponding to at least one dimension obtain the constraints corresponding to the target operator, and the constraints are used to represent the execution logic of the target operator; process at least one input information based on the constraints to obtain at least one output information, each output information Both are used to characterize the target arrangement feature of the target data, and the value of the target arrangement feature includes the target value of the first feature.
- the constraint conditions of the target operator are used to determine At least one input information is processed, so that at least one output information obtained can reflect the target arrangement characteristics of the target data, filling the situation where the rank is unknown or the rank is known but the dimension value of at least one dimension is unknown.
- the blank of the target layout feature of the target data is used.
- the arrangement feature further includes a second feature and a third feature, the second feature is a third value, the third value is used to represent a rank range, and the third feature is a fourth value Or the value of the third feature is the fifth value, the fourth value is used to represent the total dimension range of the target data when the value of the first feature is the first value, and the fifth value is used to represent the value of the first feature.
- the dimension range corresponding to each dimension obtaining at least one output information for at least one input information based on the constraints, including: processing the value of the second feature in the at least one input information based on the constraints to obtain the first a target value, the first target value is used to reflect the target range of the rank in the target data; the value of the first feature and the first target value in at least one input information are processed based on the constraint condition to obtain the second target value, the first target value
- the second target value is used to reflect the target value of the rank; the value of the third feature and the second target value in at least one input information are processed based on the constraint condition to obtain the third target value, and the third target value is used to reflect the target data
- At least one output information is obtained based on the first target value, the second target value and the third target value.
- the method may further include: determining a pre-allocated memory range of the corresponding output information based on the first target value and the third target value .
- the required memory range can be pre-allocated in advance based on the first target value and the third target value during image compilation. Better optimize memory allocation before running, so as to allocate memory reasonably and reduce unnecessary memory waste.
- the method may further include: selecting a target template based on the first target value, where the target template is used to optimize the target operator.
- the target template matching the first target value can be selected from the database, and the unmatched template can be eliminated, so that the target operator can be optimized and compiled based on the target template, so as to reduce the processing of the target operator branch, so as to select an appropriate execution algorithm to improve the compilation and execution performance of the target operator.
- the method may further include: obtaining a target arrangement feature of the target data based on any one of the at least one output information, wherein the target arrangement feature includes a first feature, a second feature and a third feature feature, the value of the first feature in the target arrangement feature is the second target value, the value of the second feature in the target arrangement feature is the first target value, and the value of the third feature in the target arrangement feature is the third value target value.
- the first value is a sign or a numerical value for indicating that the rank is unknown.
- a second aspect of the embodiments of the present application provides a data processing device, and the data processing device may include: a programming interface module for acquiring at least one input information, wherein each input information is used to characterize the arrangement feature of target data , the arrangement feature includes a first feature, the value of the first feature is a first value or the value of the first feature is a second value, the first value is used to indicate the rank of the unknown target data, and the second value is used to indicate that the The rank of the target data is known and the dimension value corresponding to at least one dimension is unknown; the programming interface module is used to obtain the constraints corresponding to the target operator, and the constraints are used to represent the execution logic of the target operator; the processing module is used based on the constraints At least one input information is processed to obtain at least one output information, each output information is used to represent a target arrangement feature of the target data, and the value of the target arrangement feature includes the target value of the first feature.
- a programming interface module for acquiring at least one input information, wherein each input information is used to character
- the arrangement feature further includes a second feature and a third feature, the second feature is a third value, the third value is used to represent a rank range, and the third feature is a fourth value Or the value of the third feature is the fifth value, the fourth value is used to represent the total dimension range of the target data when the value of the first feature is the first value, and the fifth value is used to represent the value of the first feature.
- the processing module is specifically configured to: process the value of the second feature in at least one input information according to the constraint condition to obtain the first target value, and the first target value is used for Reflect the target range of the rank in the target data; process the value of the first feature and the first target value in at least one input information according to the constraint condition to obtain a second target value, and the second target value is used to reflect the target value of the rank ; Process the value of the third feature in the at least one input information and the second target value according to the constraint condition to obtain the third target value, and the third target value is used for the target dimension range of the range target data; According to the first target value , the second target value and the third target value to obtain at least one output information.
- the processing module is further specifically configured to, after processing at least one piece of information based on a constraint condition to obtain at least one piece of output information, determine a pre-allocated memory corresponding to the output information based on the first target value and the third target value scope.
- the processing module is specifically configured to select a target template according to the first target value, and the target template is used to optimize the target operator.
- the processing module is further specifically configured to obtain a target arrangement feature of the target data based on any one of the at least one output information, wherein the target arrangement feature includes a first feature, a second feature, and a first feature.
- the target arrangement feature includes a first feature, a second feature, and a first feature.
- the value of the first feature in the target arrangement feature is the second target value
- the value of the second feature in the target arrangement feature is the first target value
- the value of the third feature in the target arrangement feature is the first target value
- the first value is a sign or a numerical value for indicating that the rank is unknown.
- a third aspect of the present application provides a data processing device, which may include: a memory for storing computer-readable instructions. It may further comprise a processor coupled to the memory for executing computer readable instructions in the memory to perform the method as described in the first aspect or any of the possible embodiments of the first aspect.
- a fourth aspect of the present application provides a computer-readable storage medium, when instructions are executed on a computer device, the computer device causes the computer device to perform the method described in the first aspect or any possible implementation manner of the first aspect.
- a fifth aspect of the present application provides a computer program product, which, when run on a computer, enables the computer to execute the method described in the first aspect or any possible implementation manner of the first aspect.
- a sixth aspect of the present application provides a chip system, where the chip system may include a processor for supporting a terminal device or a server to implement the methods involved in the first aspect or any possible implementation manner of the first aspect. function.
- the chip system may further include a memory, which is used to store necessary program instructions and data of the terminal device.
- the chip system may be composed of chips, or may include chips and other discrete devices.
- the chip system may include an application specific integrated circuit (ASIC), an off-the-shelf programmable gate array (field programmable gate array, FPGA), or other programmable logic devices.
- ASIC application specific integrated circuit
- FPGA field programmable gate array
- the chip system may also include interface circuits and the like.
- the value of the first feature in the arrangement features can reflect the rank of the unknown target data or the situation that the value of the target data is known but the dimension value corresponding to at least one dimension is unknown, the value of the dimension corresponding to at least one dimension is unknown.
- the constraints of the target operator process at least one input information, so that at least one output information obtained can reflect the target arrangement characteristics of the target data, and fill in the rank unknown or the rank is known but the dimension value of at least one dimension is unknown.
- the blank of the target arrangement feature of the target data cannot be determined.
- FIG. 1 is a flowchart of a data processing provided in an embodiment of the present application.
- FIG. 2 is a schematic diagram of a data processing method provided by an embodiment of the present application.
- FIG. 3 is a schematic diagram of a memory allocation scenario applied to an image provided in an embodiment of the present application.
- FIG. 4 is a schematic diagram of a compilation scene applied to an image provided in an embodiment of the present application.
- FIG. 5 is a schematic diagram of a hardware structure of a data processing device provided by an embodiment of the present application.
- FIG. 6 is a schematic structural diagram of an execution device provided by an embodiment of the present application.
- FIG. 7 is a schematic structural diagram of another data processing device according to an embodiment of the present application.
- a neural network can be composed of neural units, and a neural unit can refer to an operation unit that takes x s and an intercept 1 as input, and the output of the operation unit can be shown in the following formula:
- s 1, 2,...n, n is a natural number greater than 1
- Ws is the weight of xs
- b is the bias of the neural unit.
- f is the activation function of the neural unit, which is used to introduce nonlinear characteristics into the neural network to convert the input signal in the neural unit into an output signal.
- the output signal of the activation function can be used as the input of the next convolutional layer, and the activation function can be a sigmoid function.
- a neural network is a network formed by connecting a plurality of the above single neural units together, that is, the output of one neural unit can be the input of another neural unit.
- the input of each neural unit can be connected with the local receptive field of the previous layer to extract the features of the local receptive field, and the local receptive field can be an area composed of several neural units.
- DNN deep neural network
- CNN convolutional neural network
- This application does not limit the specific types of neural networks involved.
- An operator is a function that implements a specific function. For example, take the reshape operator, which is used to reinterpret the shape of tensor data. For another example, take the transpose operator as an example, the operator is used to adjust the dimension order of tensor data.
- commonly used functions for building deep learning model algorithms are collectively referred to as operators, and any operation performed on any function can be considered as an operator.
- convolution is a mathematical method of integral transformation. For example, if the function f3 is generated by two functions f1 and f2, then f1, f2 and the convolution result f3 can be regarded as an operator respectively.
- Arrangement features can be understood as being used to characterize the arrangement of target data, for example, the target data may be composed of several-dimensional pixel points, and the specific value or specific value range of the corresponding dimension value of each dimension, and so on.
- the arrangement features described above may include, but are not limited to, features such as the rank, dimension range, rank range, and/or shape of the target data, etc. of the target data.
- Rank can be understood as the number of dimensions of the target data. For example, if the target data consists of two-dimensional pixel points, the rank of the target data can be 2.
- the artificial intelligence processor is also referred to as a dedicated processor.
- the artificial intelligence processor refers to a processor for a specific application or field.
- graphics processor graphics processing unit, GPU
- display core visual processor
- display chip is a kind of special equipment used in personal computers, workstations, game consoles and some mobile devices (such as tablet computers, smart phones, etc.)
- a dedicated processor for image computing work is a special processor for image computing work.
- the neural network processor neural processing unit, NPU
- NPU neural processing unit
- Deep learning frameworks In order to meet the growing demand for neural networks, deep learning frameworks came into being. Through deep learning frameworks, researchers only need to pay attention to the network structure of deep learning algorithms, and write simple python (a cross-platform computer programming language) scripting The network structure can complete a complex deep learning network task, thereby realizing model inference and training on hardware. In other words, the deep learning framework is used to lower the development threshold in the field of deep learning, and provide the basic computing framework of deep learning for rapidly building deep learning applications.
- the current mainstream deep learning frameworks in the industry mainly include Tensorflow, Torch, Mxnet, Thenao, Caffe, etc.
- Caffe supports various types of deep learning architectures, image classification and image segmentation, and can also support convolutional neural networks (CNN), used for target Detection of convolutional neural network (region-CNN, RCNN), long short-term memory neural network (long short-term memory, LSTM) and fully connected neural network design.
- the deep learning framework can support various types of basic operators.
- the various types of basic operators involved here can include: common neural network operators.
- common neural network operators are: convolution/deconvolution operator, pooling operator, activation operator, classifier (softmax) operator, and fully connected operator.
- the activation operator may include, but is not limited to, ReLU, Sigmoid, Tanh, and other operators that can be implemented by interpolation.
- the unknown dimension value is only represented by -1, and the maximum value and the minimum value are used to represent the range of the dimension value, so as to complete the shape derivation of the output data.
- the dimension value and rank value of the data are often unknown.
- the target arrangement characteristics of the output data that can be derived are extremely high. It is probably not accurate enough, resulting in poor optimization results in scenarios such as subsequent optimization operator compilation.
- the embodiments of the present application provide a situation where the rank of the target data is in an unknown state, or in a situation where the rank is known but the dimension value corresponding to at least one dimension is also in an unknown state, a more accurate deduction can be made.
- the target arrangement feature of the target data is obtained, so that the data processing device can solve the problem that the compilation time may be uncontrollable due to the long traversal time in the process of image optimization in the subsequent image data compilation and other scenarios based on the target arrangement feature. And improve the optimization effect.
- FIG. 1 shows a flowchart of a data processing provided in an embodiment of the present application.
- each input information includes a shape that can represent the input information, dimensions range, rank (range), and rank range.
- m is an integer greater than or equal to 1
- each output information also contains All include the derived shape, dimensions range, range, and rank range and other information.
- FIG. 2 is a schematic diagram of a data processing method provided in an embodiment of the present application, as follows:
- each input information is used to represent an arrangement feature of the target data
- the arrangement feature includes a first feature
- the value of the first feature is a first value or a value of the first feature is the second value
- the first value is used to represent the rank of the unknown target data
- the second value is used to represent the rank of the known target data and the dimension value corresponding to at least one dimension is unknown.
- the described target data may include, but not limited to, data such as images and voices.
- each input information can represent different arrangement features of the same target data, and different arrangement features reflect different shapes of the target data, for example, only the rank of the target data is given in some input information, And the value of the rank is 2.
- the data processing device can know that the target data is 2-dimensional data; for another example, the value of the rank of the target data is given in some information. 4, then the data processing device should know that the target data is 4-dimensional data.
- the arrangement feature may include a first feature, and the first feature may be understood as the rank feature of the target data described above.
- the first value when the value of the first feature in a certain input information is the first value, it means that the specific value of the rank of the target data cannot be directly obtained from the input information at this time, that is, the data processing device cannot know the specific value of the rank of the target data. Exactly how many dimensions of the target data are.
- the first value described above is used to represent the rank of the unknown target data, and the first value may take a value of -1, or a range, such as [1,100]. In practical applications, the value of the first value can also be -2, -3, -4, etc. It cannot be determined that the target data is a numerical value of several-dimensional data, or it can be a symbol such as #, %, or &, or Take other ranges, such as [2,80], etc., which will not be specifically limited here.
- the processing device can know from the input information that the target data is data of several dimensions, but the target operator cannot know the dimension value corresponding to each dimension.
- one of the shapes of the target data is given in some input information, such as [-1,80].
- the data processing device can also know the shape of the target data after receiving the input information.
- the rank is 2, that is, the target data is 2-dimensional data, and the dimension value corresponding to the second dimension is 80, while the dimension value corresponding to the other first dimension is in an unknown state.
- the data processing device can know that the rank of the target data is 2, but the dimension values corresponding to the first dimension and the second dimension are unknown. state.
- the data processing device can obtain at least one input information from the operator at the upper level, for example: obtain input information 1 from operator 1, obtain input information 2 from operator 2, ... obtain input information from operator n Input information n (n ⁇ 1, and an integer) and so on.
- the data processing device can obtain the constraint condition corresponding to the target operator according to the user's requirement, so as to process the at least one input information based on the constraint condition of the target operator.
- the data processing device can obtain the constraint condition corresponding to the target operator based on the user's requirement.
- the data processing device can determine that the target operator is an addition (add). ) operator, and obtain the constraints corresponding to the addition operator, that is, the data processing device needs to know the execution logic of the target operator, such as broadcasting, shrinking and other operations.
- the target operator in the embodiment of the present application may also be other operators in practical applications, such as a subtraction operator (sub) and a multiplication operator (mul). , the exponential operator (exp), and so on.
- the value of the second feature in at least one input information based on the constraint condition to obtain a first target value, where the first target value is used to reflect the target range of the rank in the target data, wherein the arrangement feature further includes a second target value.
- the value of the second feature is the third value
- the third value is used to indicate the range of ranks
- the value of the third feature is the fourth value or the value of the third feature is the fifth value
- the third value is The four values are used to represent the total dimension range of the target data when the value of the first feature is the first value
- the fifth value is used to represent the dimension range corresponding to each dimension when the value of the first feature is the second value.
- the arrangement feature may also include a second feature and a third feature
- the described second feature can be understood as a rank range feature
- the third feature can be understood as a dimension range feature.
- the value of the second feature may be a third value, that is, the range of the rank of the target data is represented by the third value.
- the third value may be in the range of [2, 7], [3, 8], etc., which is not limited here.
- the third feature when the values of the first feature are different, the third feature also has correspondingly different values. Specifically, when the value of the first feature in a certain input information is the first value, since the first value can be used to represent the rank of the unknown target data, it is difficult to know each dimension from the corresponding input information. Therefore, the value of the third feature may be a fourth value, and the fourth value represents the total dimension range of the target data. For example, when the first value is -2, the fourth value may be [50, 200], [30, 150], etc., indicating the total dimension range when the rank of the target data is unknown, which is not limited here.
- the third feature is The value of can be a fifth value, and the fifth value indicates the corresponding dimension range of each dimension.
- the fifth value when the second value is [-1,-1], the fifth value can be [[1,100], [80,100]]; or when the second value is [-1,80], then The fifth value may be [[1,100], [80,80]], etc., which is not limited here.
- the data processing device can process the value of the second feature in the at least one input information based on the constraint condition to obtain the first target value, and the first target value can indicate the target range of the rank.
- the data processing device may further process the value of the first feature and the first target value in at least one input information based on the constraint condition to obtain the second target value.
- the target value of the rank can be represented by the second target value, and then the data processing device also determines the third target value based on the constraint condition on the value of the third feature in the at least one input information and the above-mentioned second target value, and the third target value is determined by the second target value.
- the third target value reflects the target dimension range of the target data. In this way, the data processing device can obtain at least one output information based on the first target value, the second target value and the third target value, so that each output information can represent the target arrangement feature of the target data.
- the data processing device obtains two input information used to characterize the arrangement features of the image, respectively:
- Input information 1 shape_1: [-1,80], rank_1: 2, rank_range_1: [2,2], dimensions range_1: [[1,100],[80,80]];
- Input information 2 shape_2: none, rank_2: -2, rank_range_2: [2,7], dimensions range_2: [50,200].
- the value of the first feature can be interpreted as the first value of rank_2:-2 in the input information 2, and the second value can be understood as [-1,80] in the input information 1; in addition, the first The value of the second feature as the third value can be understood as rank_range_1: [2,2] in the input information 1, and rank_range_2: [2,7] in the input information 2; the value of the third feature is the fourth value can be It is understood as the dimensions range_2 in the input information 2: [50, 200], and the value of the third feature is the fifth value can be understood as the dimensions range_1 in the input information 1: [[1, 100], [80, 80]].
- the data processing device can take the intersection between rank_range_1:[2,2] and rank_range_2:[2,7] based on the rank range derivation constraint in the add operator, and obtain The first target value is rank range_out: [2,2]. Then, the data processing device processes the first target value [2, 2] in combination with rank_2: -2 and rank_1: 2 based on the rank derivation constraint in the add operator, and obtains the second target value rank_out: 2. At this time, you can It is determined that the target data should be two-dimensional data.
- the data processing device can also process the dimensions range_1:[[1,100],[80,80]], the dimensions range_2:[50,200] and the second target value based on the dimension range derivation constraints in the add operator. Specifically, The data processing device intersects the dimension range [1,100] of the first dimension in the dimensions range_1:[[1,100],[80,80]] with the dimensions range_2:[50,200] to obtain [50,100], and then the dimensions range_1:[ The dimension range [80,80] of the second dimension in [1,100],[80,80]] and the dimensions range_2:[50,200] take the intersection to get [80,80]. In this way, the final third target value is dimensions range_out: [[50,100], [80,80]].
- the output information of the image can be: rank range_out: [2, 2], rank_out: 2, and dimensions range_out: [[50, 100], [80, 80]]. Therefore, it can be known from the output information that the image is a two-dimensional image, and the dimension range corresponding to each dimension of the image can be reduced to [[50,100], [80,80]] based on the constraints of the target operator, which is the subsequent image.
- the optimization scene of the engine provides an optimization basis and reduces the traversal time and compilation time in the process of image optimization.
- the output information may also include shape_out: [-1, 80].
- shape_out [-1, 80].
- the above only takes two input information and the add operator as an example for description. Specifically, in practical applications, one or more input information can also be processed based on the constraints of the target operator to obtain at least one output information. The details can be understood with reference to the foregoing example of the add operator, which will not be repeated here.
- the number of the output information will depend on the constraints or constraints of the target operator. For example, for the relu_grad_v2 operator, if two input information is processed, Then the obtained output information is two, which will not be specifically limited here.
- the method further includes:
- the pre-allocated memory range of the corresponding output information is determined based on the first target value and the third target value.
- the data processing device can also be based on the first target value and the third target value.
- the target value calculates the memory size required to pre-store the corresponding output information, that is, the pre-allocated memory range.
- the required memory range can be pre-allocated in advance based on the first target value and the third target value during image compilation. Better optimize memory allocation before running, so as to allocate memory reasonably and reduce unnecessary memory waste.
- FIG. 3 which is a schematic diagram of a memory allocation scenario applied to an image provided in an embodiment of the present application. As can be seen from FIG. 3 , after acquiring the input information of the image, the data processing device processes the input information based on the constraints of the target operator described above to obtain output information, and performs memory pre-allocation according to the output information.
- the aforementioned data processing method may further include: selecting a target template based on the first target value, and the target template is used to optimize the target operator.
- the data processing device can also select a target template that matches the first target value from the database, and eliminate unmatched templates, so as to facilitate
- the target operator can be optimized and compiled based on the target template to reduce the processing branches of the target operator, so as to select an appropriate execution algorithm and improve the compilation and execution performance of the target operator.
- FIG. 4 is a schematic diagram of a compilation scene applied to an image provided in an embodiment of the present application.
- the data processing device obtains the input information, processes the input information based on the constraints of the target operator described above, obtains the output information, and further calls the compilation interface provided by the target operator, so as to obtain the output information based on the constraints of the target operator described above.
- a target value selects an appropriate template for compilation, and finally outputs the compilation result.
- the target arrangement feature of the target data can be obtained based on any output information, which fills the situation where the rank is unknown or the rank is known but the dimension value of at least one dimension is unknown.
- the blanks of the target arrangement features of the target data are determined.
- the target arrangement feature also includes the aforementioned first feature, the second feature and the third feature, and the value of the first feature in the target arrangement feature can be the aforementioned second target value, and the target The value of the second feature in the arrangement features is the aforementioned first target value, and the value of the third feature in the target arrangement feature is the aforementioned third target value.
- the above-mentioned data processing device includes corresponding hardware structures and/or software modules for executing each function.
- Those skilled in the art should easily realize that the present application can be implemented in hardware or in the form of a combination of hardware and computer software. Whether a function is performed by hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of this application.
- the data processing device in FIG. 1 to FIG. 4 may be implemented by one entity device, may also be implemented jointly by multiple entity devices, or may be a logic function module in one entity device. This embodiment of the present application This is not specifically limited.
- FIG. 5 shows a schematic diagram of a hardware structure of a data processing device provided by an embodiment of the present application. It includes: a communication interface 501 and a processor 502 , and may also include a memory 503 .
- the communication interface 501 can use any transceiver-like device for communicating with other devices or communication networks, such as Ethernet, radio access network (RAN), wireless local area networks (WLAN), etc. .
- RAN radio access network
- WLAN wireless local area networks
- the processor 502 includes but is not limited to a central processing unit (CPU), a network processor (NP), an application-specific integrated circuit (ASIC) or a programmable logic device (programmable logic device, PLD) one or more.
- the above-mentioned PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a general-purpose array logic (generic array logic, GAL) or any combination thereof.
- Processor 502 is responsible for communication lines 504 and general processing, and may also provide various functions including timing, peripheral interface, voltage regulation, power management, and other control functions.
- Memory 503 may be used to store data used by processor 502 in performing operations.
- Memory 503 may be read-only memory (ROM) or other types of static storage devices that can store static information and instructions, random access memory (RAM), or other types of information and instructions It can also be an electrically erasable programmable read-only memory (electrically programmable read-only memory, EEPROM), a compact disc read-only memory (CD-ROM) or other optical disk storage, Optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or capable of carrying or storing desired program code in the form of instructions or data structures and capable of Any other medium that can be accessed by a computer, but is not limited to this.
- ROM read-only memory
- RAM random access memory
- EEPROM electrically erasable programmable read-only memory
- CD-ROM compact disc read-only memory
- Optical disc storage including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.
- the memory may exist independently and be connected to the processor 502 through the communication line 504 .
- the memory 503 may also be integrated with the processor 502 . If the memory 503 and the processor 502 are separate devices from each other, the memory 503 and the processor 502 are connected, for example, the memory 503 and the processor 502 may communicate through a communication line 504.
- the communication interface 501 and the processor 502 can communicate through a communication line 504 , and the communication interface 501 can also be directly connected to the processor 502 .
- Communication lines 504 which may include any number of interconnected buses and bridges, link together various circuits including one or more processors 502 , represented by processor 502 , and memory, represented by memory 503 . Communication lines 504 may also link together various other circuits such as peripherals, voltage regulators, and power management circuits, etc., which are well known in the art and, therefore, will not be described further herein.
- the data processing device may include: a memory for storing computer-readable instructions. It may also include a communication interface coupled with the memory for acquiring at least one input information, wherein each input information is used to characterize the arrangement feature of the target data, the arrangement feature includes a first feature, and the value of the first feature is The value of the first value or the first feature is a second value, the first value is used to represent the rank of the unknown target data, the second value is used to represent the rank of the known target data and the dimension value corresponding to at least one dimension is unknown; and Obtain the constraints corresponding to the target operator, and the constraints are used to represent the execution logic of the target operator.
- a processor coupled with the communication interface for executing computer-readable instructions in the memory to perform the following operations: process at least one input message based on constraints to obtain at least one output message, each output message for use in The target arrangement feature of the target data is represented, and the value of the target arrangement feature includes the target value of the first feature.
- the arrangement feature further includes a second feature and a third feature, the value of the second feature is a third value, the third value is used to represent the range of ranks, and the value of the third feature is the third value
- the value of the fourth value or the third feature is the fifth value, the fourth value is used to represent the total dimension range of the target data when the value of the first feature is the first value, and the fifth value is used to represent the value of the first feature.
- the processor is specifically used for: processing the value of the second feature in at least one input information based on the constraint condition to obtain the first target value, the first target value It is used to reflect the target range of the rank in the target data; the value of the first feature and the first target value in at least one input information are processed based on the constraints to obtain a second target value, and the second target value is used to reflect the rank.
- target value process the value of the third feature and the second target value in at least one input information based on the constraint condition to obtain a third target value, and the third target value is used to reflect the target dimension range of the target data; based on the first At least one output information is obtained from the target value, the second target value and the third target value.
- the processor is further configured to: process at least one input information based on a constraint condition, and after obtaining at least one output information, determine a prediction of the corresponding output information based on the first target value and the third target value Allocate a memory range.
- the processor is specifically configured to: select a target template based on the first target value, and the target template is used to optimize the target operator.
- the processor is specifically configured to: obtain a target arrangement feature of the target data based on any one of the at least one output information, wherein the target arrangement feature includes a first feature, a second feature and The third feature, the value of the first feature in the target arrangement feature is the second target value, the value of the second feature in the target arrangement feature is the first target value, and the value of the third feature in the target arrangement feature is the value third target value.
- the first value is a symbol or a numerical value used to indicate that the rank is unknown.
- the execution device may include a processor 601 , a memory 602 , a communication bus 603 , and a communication interface 604 , and the artificial intelligence processor 605 is connected to the memory 602 and the communication interface 604 through the communication bus 603 .
- the processor 601 may be a central processing unit (CPU), and the processor 601 may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs) ), off-the-shelf programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
- the processor 601 may be a microprocessor or the processor 601 may be any conventional processor or the like.
- the processor 601 may also be an integrated circuit chip, which has signal processing capability.
- each step of the data processing method of the present application may be completed by an integrated logic circuit of hardware in the processor 601 or instructions in the form of software.
- the memory 602 may be read-only memory (ROM), random access memory (RAM), or other memory. In this embodiment of the present application, the memory 602 is used for storing data and various software programs.
- the memory 602 may include a physical device for storing information, and usually the information is digitized and then stored in a medium using electrical, magnetic, or optical methods.
- the memory of this embodiment may further include: devices that use electrical energy to store information, such as RAM, ROM, etc.; devices that use magnetic energy to store information, such as hard disks, floppy disks, magnetic tapes, magnetic core memory, magnetic bubble memory, U disk; use A device that stores information optically, such as a CD or DVD.
- devices that use electrical energy to store information such as RAM, ROM, etc.
- devices that use magnetic energy to store information such as hard disks, floppy disks, magnetic tapes, magnetic core memory, magnetic bubble memory, U disk
- use A device that stores information optically such as a CD or DVD.
- quantum memory graphene memory, and so on.
- the communication interface 604 uses transceiving means such as, but not limited to, a transceiver to enable communication between the executing device and other devices or a communication network. For example, at least one input message or the like may be received via the communication interface 604 .
- the execution device may further include at least one artificial intelligence processor 605 .
- the artificial intelligence processor 605 can be mounted on the main CPU (host CPU) as a co-processor, and the main CPU assigns tasks to it.
- the artificial intelligence processor 605 may implement one or more operations. For example, taking a neural network processor (network processing unit, NPU) NPU as an example, the core part of the NPU is an arithmetic circuit, and the controller controls the arithmetic circuit to extract the matrix data in the memory 602 and perform multiplication and addition operations.
- NPU network processing unit
- the artificial intelligence processor 605 may include 8 clusters (clusters), and each cluster includes 4 artificial intelligence processor cores.
- the artificial intelligence processor 605 may be an artificial intelligence processor with a reconfigurable architecture.
- the reconfigurable architecture refers to that if an artificial intelligence processor can utilize reusable hardware resources and flexibly change its own architecture according to different application requirements, in order to provide corresponding requirements for each specific application If it matches the architecture, the artificial intelligence processor is called a reconfigurable computing system, and its architecture is called a reconfigurable architecture.
- execution device is only an example provided by the embodiments of the present application, and the execution device may have more or less components than those shown, may combine two or more components, or may have a combination of components Different configurations are implemented.
- the present application may divide the data processing device into functional units according to the above method embodiments.
- each functional unit may be divided corresponding to each function, or two or more functions may be integrated into one function. in the unit.
- the above-mentioned integrated functional units may be implemented in the form of hardware, and may also be implemented in the form of software functional units.
- FIG. 7 shows a schematic structural diagram of a data processing device provided by an embodiment of the present application.
- an embodiment of the data processing device of the present application may include:
- the programming interface module 701 is used to obtain at least one input information, wherein each input information is used to represent the arrangement feature of the target data, the arrangement feature includes a first feature, and the value of the first feature is a first value or a first value.
- the value of a feature is a second value, the first value is used to represent the rank of the unknown target data, the second value is used to represent the rank of the known target data and the dimension value corresponding to at least one dimension is unknown;
- the programming interface module 701 is used to obtain the constraint condition corresponding to the target operator, and the constraint condition is used to characterize the execution logic of the target operator;
- the processing module 702 is configured to process at least one input information based on the constraint condition to obtain at least one output information, each output information is used to characterize the target arrangement feature of the target data, and the value of the target arrangement feature includes the first feature target value.
- the arrangement feature further includes a second feature and a third feature, the second feature is a third value, the third value is used to represent a rank range, and the third feature is a fourth value Or the value of the third feature is the fifth value, the fourth value is used to represent the total dimension range of the target data when the value of the first feature is the first value, and the fifth value is used to represent the value of the first feature.
- the processing module 702 is specifically used for:
- the value of the second feature in at least one input information is processed according to the constraint condition to obtain a first target value, and the first target value is used to reflect the target range of the rank in the target data;
- the value of the first feature and the first target value in the at least one input information are processed according to the constraint condition to obtain the second target value, and the second target value is used to reflect the target value of the rank;
- the value of the third feature and the second target value in the at least one input information are processed according to the constraint condition to obtain the third target value, and the third target value is used for the target dimension range of the range target data;
- At least one output information is obtained according to the first target value, the second target value and the third target value.
- the processing module 702 is further specifically configured to: after the at least one piece of information is processed based on the constraint condition to obtain at least one piece of output information, determine the pre-allocation of the corresponding output information based on the first target value and the third target value memory range.
- the processing module 702 is configured to select a target template according to the first target value, and the target template is used to optimize the target operator.
- the processing module 702 is further configured to obtain a target arrangement feature of the target data based on any one of the at least one output information, wherein the target arrangement feature includes a first feature, a second feature, and a first feature.
- the target arrangement feature includes a first feature, a second feature, and a first feature.
- the value of the first feature in the target arrangement feature is the second target value
- the value of the second feature in the target arrangement feature is the first target value
- the value of the third feature in the target arrangement feature is the first target value
- a computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the procedures or functions according to the embodiments of the present application are generated in whole or in part.
- the computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable device.
- Computer instructions may be stored on or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server, or data center over a wire (e.g. coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (eg, infrared, wireless, microwave, etc.) to another website site, computer, server, or data center.
- a wire e.g. coaxial cable, fiber optic, digital subscriber line (DSL)
- wireless e.g, infrared, wireless, microwave, etc.
- the computer-readable storage medium can be any available medium that can be stored by a computer or a data storage device such as a server, a data center, etc. that includes one or more available media integrated.
- Useful media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVD), or semiconductor media (eg, Solid State Disk (SSD)), among others.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Health & Medical Sciences (AREA)
- Computing Systems (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Evolutionary Computation (AREA)
- Life Sciences & Earth Sciences (AREA)
- Molecular Biology (AREA)
- Artificial Intelligence (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Health & Medical Sciences (AREA)
- Feedback Control In General (AREA)
- General Factory Administration (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Image Analysis (AREA)
Abstract
A data processing method and a related device, which relate to the field of artificial intelligence, and are used for filling in the gap of it being impossible to determine a target arrangement feature of target data when a rank is unknown or the rank is known but a dimension value of at least one dimension is unknown. The method comprises: acquiring at least one piece of input information, wherein each piece of input information is used for representing an arrangement feature of target data, the arrangement feature comprises a first feature, the value of the first feature is a first value or the value of the first feature is a second value, the first value is used for representing that the rank of the target data is unknown, and the second value is used for representing that the rank of the target data is known and a dimension value corresponding to at least one dimension is unknown; acquiring a constraint condition corresponding to a target operator; and processing the at least one piece of input information on the basis of the constraint condition, so as to obtain at least one piece of output information, wherein each piece of output information is used for representing a target arrangement feature of the target data, and the value of the target arrangement feature comprises a target value of the first feature.
Description
本申请涉及通信技术领域,具体涉及一种数据处理的方法以及相关设备。The present application relates to the field of communication technologies, and in particular, to a data processing method and related equipment.
人工智能(artificial intelligence,AI)是利用数字计算机或者数字计算机控制的机器模拟、延伸和扩展人的智能,感知环境、获取知识并使用知识获得最佳结果的理论、方法、技术及应用系统。换句话说,人工智能是计算机科学的一个分支,它企图了解智能的实质,并生产出一种新的能以人类智能相似的方式作出反应的智能机器。人工智能也就是研究各种智能机器的设计原理与实现方法,使机器具有感知、推理与决策的功能。人工智能领域的研究包括机器人,自然语言处理,计算机视觉,决策与推理,人机交互,推荐与搜索,AI基础理论等。随着AI的快速发展以及深度学习应用进一步的拓展,不仅要实现一些定制化的算子,而且还需要一套用于实现算子的输出数据的形状的推导方法,以便于在图像编译或者运行图像的过程中该推导方法能够被调用。Artificial intelligence (AI) is a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a branch of computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that responds in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that the machines have the functions of perception, reasoning and decision-making. Research in the field of artificial intelligence includes robotics, natural language processing, computer vision, decision-making and reasoning, human-computer interaction, recommendation and search, and basic AI theory. With the rapid development of AI and the further expansion of deep learning applications, it is not only necessary to implement some customized operators, but also a set of derivation methods for realizing the shape of the output data of the operators, so as to compile or run images on images. The derivation method can be called during the process.
而在相关技术中,仅仅通过-1表示未知的维度值,并且使用最大值与最小值来表示该维度值的范围,以用来完成输出数据的形态的推导。但是,在一个神经网络(neural network,NN)的模型中,经常会出现输入数据的维度值和秩值都存在未知的情况,因此,对如何更好地推导出输出数据的形状提出了新的挑战。In the related art, an unknown dimension value is only represented by -1, and the range of the dimension value is represented by the maximum value and the minimum value, so as to complete the derivation of the shape of the output data. However, in a neural network (NN) model, the dimension value and rank value of the input data are often unknown. Therefore, a new method is proposed for how to better derive the shape of the output data. challenge.
发明内容SUMMARY OF THE INVENTION
本申请实施例提供了一种数据处理的方法以及相关设备,旨在填补在秩未知或者秩已知但至少一个维度的维度值未知的情况下,无法确定出目标数据的目标排布特征的空白。The embodiments of the present application provide a data processing method and related equipment, which aim to fill in the blank that the target arrangement feature of target data cannot be determined when the rank is unknown or the rank is known but the dimension value of at least one dimension is unknown. .
本申请实施例的第一方面提供一种数据处理的方法,该方法可以包括:获取至少一个输入信息,其中,每个输入信息均用于表征目标数据的排布特征,排布特征包括第一特征,第一特征的取值为第一值或第一特征的取值为第二值,第一值用于表示未知目标数据的秩,第二值用于表示已知目标数据的秩且未知至少一个维度对应的维度值;获取目标算子对应的约束条件,约束条件用于表征目标算子的执行逻辑;基于约束条件对至少一个输入信息进行处理,得到至少一个输出信息,每个输出信息均用于表征目标数据的目标排布特征,目标排布特征的取值包括第一特征的目标值。通过上述方式,在排布特征中第一特征的取值反映出未知目标数据的秩或者已知目标数据的值但未知至少一个维度对应的维度值的情况下,通过目标算子的约束条件对至少一个输入信息进行处理,使得得到的至少一个输出信息均能够反映出目标数据的目标排布特征,填补了在秩未知或者秩已知但至少一个维度的维度值未知的情况下,无法确定出目标数据的目标排布特征的空白。A first aspect of the embodiments of the present application provides a data processing method, the method may include: acquiring at least one piece of input information, wherein each input information is used to represent an arrangement feature of target data, and the arrangement feature includes a first feature, the value of the first feature is the first value or the value of the first feature is the second value, the first value is used to represent the rank of the unknown target data, and the second value is used to represent the rank of the known target data and unknown The dimension value corresponding to at least one dimension; obtain the constraints corresponding to the target operator, and the constraints are used to represent the execution logic of the target operator; process at least one input information based on the constraints to obtain at least one output information, each output information Both are used to characterize the target arrangement feature of the target data, and the value of the target arrangement feature includes the target value of the first feature. In the above manner, in the case where the value of the first feature in the arrangement features reflects the rank of the unknown target data or the value of the known target data but the dimension value corresponding to at least one dimension is unknown, the constraint conditions of the target operator are used to determine At least one input information is processed, so that at least one output information obtained can reflect the target arrangement characteristics of the target data, filling the situation where the rank is unknown or the rank is known but the dimension value of at least one dimension is unknown. The blank of the target layout feature of the target data.
在一些实施例中,排布特征还包括第二特征和第三特征,第二特征的取值为第三值,第三值用于表示秩的范围,第三特征的取值为第四值或第三特征的取值为第五值,第四值用于表示第一特征的取值为第一值时,目标数据的维度总范围,第五值用于表示第一特征的取值为第二值时,每一个维度对应的维度范围;基于约束条件对至少一个输入信息,得 到至少一个输出信息,包括:基于约束条件对至少一个输入信息中第二特征的取值进行处理,得到第一目标值,第一目标值用于反映目标数据中秩的目标范围;基于约束条件对至少一个输入信息中第一特征的取值、以及第一目标值进行处理,得到第二目标值,第二目标值用于反映秩的目标值;基于约束条件对至少一个输入信息中第三特征的取值、以及第二目标值进行处理,得到第三目标值,第三目标值用于反映目标数据的目标维度范围;基于第一目标值、第二目标值以及第三目标值得到至少一个输出信息。In some embodiments, the arrangement feature further includes a second feature and a third feature, the second feature is a third value, the third value is used to represent a rank range, and the third feature is a fourth value Or the value of the third feature is the fifth value, the fourth value is used to represent the total dimension range of the target data when the value of the first feature is the first value, and the fifth value is used to represent the value of the first feature. When the second value is the second value, the dimension range corresponding to each dimension; obtaining at least one output information for at least one input information based on the constraints, including: processing the value of the second feature in the at least one input information based on the constraints to obtain the first a target value, the first target value is used to reflect the target range of the rank in the target data; the value of the first feature and the first target value in at least one input information are processed based on the constraint condition to obtain the second target value, the first target value The second target value is used to reflect the target value of the rank; the value of the third feature and the second target value in at least one input information are processed based on the constraint condition to obtain the third target value, and the third target value is used to reflect the target data At least one output information is obtained based on the first target value, the second target value and the third target value.
在一些实施例中,基于约束条件对至少一个输入信息进行处理,得到至少一个输出信息之后,该方法还可以包括:基于第一目标值和第三目标值确定对应的输出信息的预分配内存范围。通过上述方式,能够在图像编译期基于第一目标值与第三目标值提前预分配出所需要的内存范围,相较于在图像运行时期基于已知的秩和维度范围再确定内存范围,能够在运行前更好地优化内存的分配,以便于合理分配内存,减少不必要的内存浪费。In some embodiments, after the at least one input information is processed based on the constraint condition to obtain at least one output information, the method may further include: determining a pre-allocated memory range of the corresponding output information based on the first target value and the third target value . In the above manner, the required memory range can be pre-allocated in advance based on the first target value and the third target value during image compilation. Better optimize memory allocation before running, so as to allocate memory reasonably and reduce unnecessary memory waste.
在一些实施例中,该方法还可以包括:基于第一目标值选取目标模板,目标模板用于优化目标算子。通过上述方式,能够从数据库中选择相与第一目标值相匹配的目标模板,剔除不匹配的模板,以便于能够基目标模板对目标算子进行优化和编译优化,以减少目标算子的处理分支,从而选择合适的执行算法,以提高目标算子的编译和执行性能。In some embodiments, the method may further include: selecting a target template based on the first target value, where the target template is used to optimize the target operator. Through the above method, the target template matching the first target value can be selected from the database, and the unmatched template can be eliminated, so that the target operator can be optimized and compiled based on the target template, so as to reduce the processing of the target operator branch, so as to select an appropriate execution algorithm to improve the compilation and execution performance of the target operator.
在另一些实施例中,该方法还可以包括:基于至少一个输出信息中的任意一个输出信息得到目标数据的目标排布特征,其中,目标排布特征包括第一特征、第二特征以及第三特征,目标排布特征中第一特征的取值为第二目标值,目标排布特征中第二特征的取值为第一目标值,目标排布特征中第三特征的取值为第三目标值。In other embodiments, the method may further include: obtaining a target arrangement feature of the target data based on any one of the at least one output information, wherein the target arrangement feature includes a first feature, a second feature and a third feature feature, the value of the first feature in the target arrangement feature is the second target value, the value of the second feature in the target arrangement feature is the first target value, and the value of the third feature in the target arrangement feature is the third value target value.
在另一些实施例中,第一值为符号或用于表示秩未知的数值。In other embodiments, the first value is a sign or a numerical value for indicating that the rank is unknown.
本申请实施例第二方面提供了一种数据处理设备,该数据处理设备可以包括:编程接口模块,用于获取至少一个输入信息,其中,每个输入信息均用于表征目标数据的排布特征,排布特征包括第一特征,第一特征的取值为第一值或第一特征的取值为第二值,第一值用于表示未知目标数据的秩,第二值用于表示已知目标数据的秩且未知至少一个维度对应的维度值;编程接口模块,用于获取目标算子对应的约束条件,约束条件用于表征目标算子的执行逻辑;处理模块,用于基于约束条件对至少一个输入信息进行处理,得到至少一个输出信息,每个输出信息均用于表征目标数据的目标排布特征,目标排布特征的取值包括第一特征的目标值。A second aspect of the embodiments of the present application provides a data processing device, and the data processing device may include: a programming interface module for acquiring at least one input information, wherein each input information is used to characterize the arrangement feature of target data , the arrangement feature includes a first feature, the value of the first feature is a first value or the value of the first feature is a second value, the first value is used to indicate the rank of the unknown target data, and the second value is used to indicate that the The rank of the target data is known and the dimension value corresponding to at least one dimension is unknown; the programming interface module is used to obtain the constraints corresponding to the target operator, and the constraints are used to represent the execution logic of the target operator; the processing module is used based on the constraints At least one input information is processed to obtain at least one output information, each output information is used to represent a target arrangement feature of the target data, and the value of the target arrangement feature includes the target value of the first feature.
在一些实施例中,排布特征还包括第二特征和第三特征,第二特征的取值为第三值,第三值用于表示秩的范围,第三特征的取值为第四值或第三特征的取值为第五值,第四值用于表示第一特征的取值为第一值时,目标数据的维度总范围,第五值用于表示第一特征的取值为第二值时,每一个维度对应的维度范围;处理模块,具体用于:根据约束条件对至少一个输入信息中第二特征的取值进行处理,得到第一目标值,第一目标值用于反映目标数据中秩的目标范围;根据约束条件对至少一个输入信息中第一特征的取值、以及第一目标值进行处理,得到第二目标值,第二目标值用于反映秩的目标值;根据约束条件对至少一个输入信息中第三特征的取值、以及第二目标值进行处理,得到第三目标值,第三目标值用于范围目标数据的目标维度范围;根据第一目标值、第二目标值以及第三目标值得 到至少一个输出信息。In some embodiments, the arrangement feature further includes a second feature and a third feature, the second feature is a third value, the third value is used to represent a rank range, and the third feature is a fourth value Or the value of the third feature is the fifth value, the fourth value is used to represent the total dimension range of the target data when the value of the first feature is the first value, and the fifth value is used to represent the value of the first feature. When the second value is the second value, the dimension range corresponding to each dimension; the processing module is specifically configured to: process the value of the second feature in at least one input information according to the constraint condition to obtain the first target value, and the first target value is used for Reflect the target range of the rank in the target data; process the value of the first feature and the first target value in at least one input information according to the constraint condition to obtain a second target value, and the second target value is used to reflect the target value of the rank ; Process the value of the third feature in the at least one input information and the second target value according to the constraint condition to obtain the third target value, and the third target value is used for the target dimension range of the range target data; According to the first target value , the second target value and the third target value to obtain at least one output information.
在另一些实施例中,处理模块,还具体用于在基于约束条件对至少一个信息进行处理,得到至少一个输出信息之后,基于第一目标值和第三目标值确定对应输出信息的预分配内存范围。In other embodiments, the processing module is further specifically configured to, after processing at least one piece of information based on a constraint condition to obtain at least one piece of output information, determine a pre-allocated memory corresponding to the output information based on the first target value and the third target value scope.
在另一些实施例中,处理模块,具体用于根据第一目标值选取目标模板,目标模板用于优化目标算子。In other embodiments, the processing module is specifically configured to select a target template according to the first target value, and the target template is used to optimize the target operator.
在另一些实施例中,处理模块,还具体用于基于至少一个输出信息中的任意一个输出信息得到目标数据的目标排布特征,其中,目标排布特征包括第一特征、第二特征以及第三特征,目标排布特征中第一特征的取值为第二目标值,目标排布特征中第二特征的取值为第一目标值,目标排布特征中第三特征的取值为第三目标值。In other embodiments, the processing module is further specifically configured to obtain a target arrangement feature of the target data based on any one of the at least one output information, wherein the target arrangement feature includes a first feature, a second feature, and a first feature. Three features, the value of the first feature in the target arrangement feature is the second target value, the value of the second feature in the target arrangement feature is the first target value, and the value of the third feature in the target arrangement feature is the first target value Three target values.
在另一些实施例中,第一值为符号或用于表示秩未知的数值。In other embodiments, the first value is a sign or a numerical value for indicating that the rank is unknown.
本申请第三方面提供一种数据处理设备,可以包括:存储器,用于存储计算机可读指令。还可以包括,与存储器耦合的处理器,用于执行存储器中的计算机可读指令从而执行如第一方面或第一方面任意一种可能的实施方式中所描述的方法。A third aspect of the present application provides a data processing device, which may include: a memory for storing computer-readable instructions. It may further comprise a processor coupled to the memory for executing computer readable instructions in the memory to perform the method as described in the first aspect or any of the possible embodiments of the first aspect.
本申请第四方面提供一种计算机可读存储介质,当指令在计算机装置上运行时,使得计算机装置执行如第一方面或第一方面任意一种可能的实施方式中所描述的方法。A fourth aspect of the present application provides a computer-readable storage medium, when instructions are executed on a computer device, the computer device causes the computer device to perform the method described in the first aspect or any possible implementation manner of the first aspect.
本申请第五方面提供一种计算机程序产品,当在计算机上运行时,使得计算机可以执行如第一方面或第一方面任意一种可能的实施方式中所描述的方法。A fifth aspect of the present application provides a computer program product, which, when run on a computer, enables the computer to execute the method described in the first aspect or any possible implementation manner of the first aspect.
本申请第六方面提供一种芯片系统,该芯片系统可以包括处理器,用于支持终端设备或服务器实现上述第一方面或第一方面任意一种可能的实施方式中所描述的方法中所涉及的功能。A sixth aspect of the present application provides a chip system, where the chip system may include a processor for supporting a terminal device or a server to implement the methods involved in the first aspect or any possible implementation manner of the first aspect. function.
可选地,结合上述第六方面,在第一种可能的实施方式中,芯片系统还可以包括存储器,存储器,用于保存终端设备必要的程序指令和数据。该芯片系统,可以由芯片构成,也可以包含芯片和其他分立器件。其中,芯片系统可以可以包括专用集成电路(application specific integrated circuit,ASIC)、现成可编程门阵列(field programmable gate array,FPGA)或者其他可编程逻辑器件等。进一步,芯片系统还可以可以包括接口电路等。Optionally, in combination with the above sixth aspect, in a first possible implementation manner, the chip system may further include a memory, which is used to store necessary program instructions and data of the terminal device. The chip system may be composed of chips, or may include chips and other discrete devices. Wherein, the chip system may include an application specific integrated circuit (ASIC), an off-the-shelf programmable gate array (field programmable gate array, FPGA), or other programmable logic devices. Further, the chip system may also include interface circuits and the like.
需要说明的是,本申请第二方面至第六方面的实施方式所带来的有益效果可以参照第一方面的实施方式进行理解,此处不做重复赘述。It should be noted that, the beneficial effects brought by the implementations of the second aspect to the sixth aspect of the present application can be understood with reference to the implementation of the first aspect, which will not be repeated here.
本申请实施例提供的技术方案中,由于排布特征中第一特征的取值能够反映出未知目标数据的秩或者已知目标数据的值但未知至少一个维度对应的维度值的情况,因此通过目标算子的约束条件对至少一个输入信息进行处理,使得得到的至少一个输出信息均能够反映出目标数据的目标排布特征,填补了在秩未知或者秩已知但至少一个维度的维度值未知的情况下,无法确定出目标数据的目标排布特征的空白。In the technical solutions provided by the embodiments of the present application, since the value of the first feature in the arrangement features can reflect the rank of the unknown target data or the situation that the value of the target data is known but the dimension value corresponding to at least one dimension is unknown, the value of the dimension corresponding to at least one dimension is unknown. The constraints of the target operator process at least one input information, so that at least one output information obtained can reflect the target arrangement characteristics of the target data, and fill in the rank unknown or the rank is known but the dimension value of at least one dimension is unknown. In the case of , the blank of the target arrangement feature of the target data cannot be determined.
图1为本申请实施例中提供的一种数据处理的流程图;1 is a flowchart of a data processing provided in an embodiment of the present application;
图2为本申请实施例提供的一种数据处理的方法的示意图;2 is a schematic diagram of a data processing method provided by an embodiment of the present application;
图3为本申请实施例中提供的应用于图像的内存分配场景的示意图;3 is a schematic diagram of a memory allocation scenario applied to an image provided in an embodiment of the present application;
图4为本申请实施例中提供的应用于图像的编译场景的示意图;4 is a schematic diagram of a compilation scene applied to an image provided in an embodiment of the present application;
图5为本申请实施例提供的数据处理设备的硬件结构示意图;5 is a schematic diagram of a hardware structure of a data processing device provided by an embodiment of the present application;
图6为本申请实施例提供的一种执行设备的结构示意图;FIG. 6 is a schematic structural diagram of an execution device provided by an embodiment of the present application;
图7为本申请实施例提供的另一种数据处理设备的结构示意图。FIG. 7 is a schematic structural diagram of another data processing device according to an embodiment of the present application.
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述。应当理解,本申请的说明书和权利要求书中使用的术语“包括”和“包含”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。还应当理解,本申请说明书中所使用的术语仅仅是出于描述特定实施例的目的,而并不意在限定本申请。The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings in the embodiments of the present application. It is to be understood that the terms "comprising" and "comprising" used in the description and claims of this application indicate the presence of the described features, integers, steps, operations, elements and/or components, but do not exclude one or more other The presence or addition of features, integers, steps, operations, elements, components and/or sets thereof. It should also be understood that the terms used in the specification of the present application are only for the purpose of describing particular embodiments, and are not intended to limit the present application.
为了能够更好的理解本申请所描述的技术方案,下面对本申请实施例所涉及的关键技术术语进行解释:In order to better understand the technical solutions described in this application, the key technical terms involved in the embodiments of this application are explained below:
由于本申请实施例涉及到了神经网络的应用,为了便于理解,下面先对本申请实施例涉及的相关术语及神经网络等相关概念进行介绍。Since the embodiments of the present application involve the application of neural networks, for ease of understanding, related terms and related concepts such as neural networks involved in the embodiments of the present application are first introduced below.
(1)神经网络(1) Neural network
神经网络可以是由神经单元组成的,神经单元可以是指以x
s和截距1为输入的运算单元,该运算单元的输出可以如下公式所示:
A neural network can be composed of neural units, and a neural unit can refer to an operation unit that takes x s and an intercept 1 as input, and the output of the operation unit can be shown in the following formula:
其中,s=1、2、……n,n为大于1的自然数,Ws为xs的权重,b为神经单元的偏置。f为神经单元的激活函数(activation functions),用于将非线性特性引入神经网络中,来将神经单元中的输入信号转换为输出信号。该激活函数的输出信号可以作为下一层卷积层的输入,激活函数可以是sigmoid函数。神经网络是将多个上述单一的神经单元联结在一起形成的网络,即一个神经单元的输出可以是另一个神经单元的输入。每个神经单元的输入可以与前一层的局部接受域相连,来提取局部接受域的特征,局部接受域可以是由若干个神经单元组成的区域。Among them, s=1, 2,...n, n is a natural number greater than 1, Ws is the weight of xs, and b is the bias of the neural unit. f is the activation function of the neural unit, which is used to introduce nonlinear characteristics into the neural network to convert the input signal in the neural unit into an output signal. The output signal of the activation function can be used as the input of the next convolutional layer, and the activation function can be a sigmoid function. A neural network is a network formed by connecting a plurality of the above single neural units together, that is, the output of one neural unit can be the input of another neural unit. The input of each neural unit can be connected with the local receptive field of the previous layer to extract the features of the local receptive field, and the local receptive field can be an area composed of several neural units.
神经网络有多种类型,例如,深度神经网络(deep neural network,DNN),也称多层神经网络,也就是具有多层隐含层的神经网络;再例如,卷积神经网络(convolutional neuron network,CNN),是带有卷积结构的深度神经网络。本申请不限定涉及的神经网络的具体类型。There are many types of neural networks, for example, deep neural network (DNN), also known as multi-layer neural network, that is, a neural network with multiple layers of hidden layers; another example, convolutional neural network (convolutional neuron network) , CNN), is a deep neural network with a convolutional structure. This application does not limit the specific types of neural networks involved.
(2)算子(2) Operator
算子是指实现某种特定功能的函数。例如,以reshape算子为例,该算子用于对张量数据的形状进行重新诠释。又例如,以transpose算子为例,该算子用于调整张量数据的维度顺序。在本申请中,用于构建深度学习模型算法的常用的函数统称为算子,对任何函数进行某一项操作都可以认为是一个算子。比如卷积是一种积分变换的数学方法,比如是通过两个函数f1和f2生成的函数f3,则可以将f1、f2以及卷积结果f3分别看做一个算 子。An operator is a function that implements a specific function. For example, take the reshape operator, which is used to reinterpret the shape of tensor data. For another example, take the transpose operator as an example, the operator is used to adjust the dimension order of tensor data. In this application, commonly used functions for building deep learning model algorithms are collectively referred to as operators, and any operation performed on any function can be considered as an operator. For example, convolution is a mathematical method of integral transformation. For example, if the function f3 is generated by two functions f1 and f2, then f1, f2 and the convolution result f3 can be regarded as an operator respectively.
(3)排布特征(3) Arrangement features
排布特征可以理解成用于表征目标数据的排布方式,比如该目标数据可以由几维的像素点组成,以及每一维对应维度值的具体取值或者具体的取值范围等等。上述所描述的排布特征可以包括但不限于目标数据的秩、维度范围、秩范围和/或该目标数据的形状等等特征。Arrangement features can be understood as being used to characterize the arrangement of target data, for example, the target data may be composed of several-dimensional pixel points, and the specific value or specific value range of the corresponding dimension value of each dimension, and so on. The arrangement features described above may include, but are not limited to, features such as the rank, dimension range, rank range, and/or shape of the target data, etc. of the target data.
(4)秩(4) Rank
秩可以理解成目标数据的维度数目。例如,目标数据由二维像素点组成,那么该目标数据的秩可以为2。Rank can be understood as the number of dimensions of the target data. For example, if the target data consists of two-dimensional pixel points, the rank of the target data can be 2.
(5)人工智能处理器(5) Artificial intelligence processor
人工智能处理器,也称之为专用处理器,在本申请实施例中,人工智能处理器是指针对特定应用或者领域的处理器。例如:图形处理器(graphics processing unit,GPU),又称显示核心、视觉处理器、显示芯片,是一种专门在个人电脑、工作站、游戏机和一些移动设备(如平板电脑、智能手机等)上进行图像运算工作的专用处理器。又例如:神经网络处理器(neural processing unit,NPU),是一种在人工智能领域的应用中针对矩阵乘法运算的专用处理器,采用“数据驱动并行计算”的架构,特别擅长处理视频、图像类的海量多媒体数据。The artificial intelligence processor is also referred to as a dedicated processor. In this embodiment of the present application, the artificial intelligence processor refers to a processor for a specific application or field. For example: graphics processor (graphics processing unit, GPU), also known as display core, visual processor, display chip, is a kind of special equipment used in personal computers, workstations, game consoles and some mobile devices (such as tablet computers, smart phones, etc.) A dedicated processor for image computing work. Another example: the neural network processor (neural processing unit, NPU) is a special processor for matrix multiplication in the field of artificial intelligence. It adopts the architecture of "data-driven parallel computing" and is especially good at processing video and images. class of massive multimedia data.
(6)深度学习框架(6) Deep Learning Framework
为了满足日益增长的神经网络需求,深度学习框架应运而生,通过深度学习框架,研究人员只需要关注深度学习算法网络结构,通过编写简单的python(一种跨平台的计算机程序设计语言)脚本编写网络结构就能完成一个复杂的深度学习网络任务,从而实现在硬件上模型推理和训练。换句话说,深度学习框架用于降低深度学习领域开发门槛,提供深度学习的基础计算框架,用于快速构建深度学习应用。当前业界主流的深度学习框架主要有Tensorflow、Torch、Mxnet、Thenao、Caffe等。以卷积神经网络框架Caffe为例,在实际应用中,Caffe支持多种类型的深度学习架构、面向图像分类和图像分割,还可以支持卷积神经网络(convolutional neural networks,CNN)、用于目标检测的卷积神经网络(region-CNN,RCNN)、长短期记忆神经网络(long short-term memory,LSTM)和全连接神经网络设计。深度学习框架可以支持多种类型的基本算子,具体地,这里所涉及的多种类型的基本算子可以包括:常见的神经网络算子。例如,常见的神经网络算子有:卷积/反卷积算子,池化算子,激活算子、分类器(softmax)算子,全连接算子。其中,激活算子可以包括但不限于ReLU、Sigmoid、Tanh以及其他可以用插值方式实现的算子。In order to meet the growing demand for neural networks, deep learning frameworks came into being. Through deep learning frameworks, researchers only need to pay attention to the network structure of deep learning algorithms, and write simple python (a cross-platform computer programming language) scripting The network structure can complete a complex deep learning network task, thereby realizing model inference and training on hardware. In other words, the deep learning framework is used to lower the development threshold in the field of deep learning, and provide the basic computing framework of deep learning for rapidly building deep learning applications. The current mainstream deep learning frameworks in the industry mainly include Tensorflow, Torch, Mxnet, Thenao, Caffe, etc. Taking the convolutional neural network framework Caffe as an example, in practical applications, Caffe supports various types of deep learning architectures, image classification and image segmentation, and can also support convolutional neural networks (CNN), used for target Detection of convolutional neural network (region-CNN, RCNN), long short-term memory neural network (long short-term memory, LSTM) and fully connected neural network design. The deep learning framework can support various types of basic operators. Specifically, the various types of basic operators involved here can include: common neural network operators. For example, common neural network operators are: convolution/deconvolution operator, pooling operator, activation operator, classifier (softmax) operator, and fully connected operator. The activation operator may include, but is not limited to, ReLU, Sigmoid, Tanh, and other operators that can be implemented by interpolation.
在相关技术中,仅仅通过-1表示未知的维度值,并且使用最大值与最小值来表示该维度值的范围,以用来完成输出数据的形状推导。但是,在一个神经网络(neural network,NN)的模型中,经常会出现数据的维度值和秩值都存在未知的情况,在这种情况下所能够推导出的输出数据的目标排布特征极大可能地不够准确,导致后续优化算子编译等场景,优化效果欠佳。In the related art, the unknown dimension value is only represented by -1, and the maximum value and the minimum value are used to represent the range of the dimension value, so as to complete the shape derivation of the output data. However, in a neural network (NN) model, the dimension value and rank value of the data are often unknown. In this case, the target arrangement characteristics of the output data that can be derived are extremely high. It is probably not accurate enough, resulting in poor optimization results in scenarios such as subsequent optimization operator compilation.
为了解决上述的问题,本申请实施例中提供了在目标数据的秩处于未知状态的情况, 或者秩已知但存在至少一个维度对应的维度值也处于未知状态的情况下,能够较为准确地推导出目标数据的目标排布特征,使得数据处理设备能够基于目标排布特征在后续图像据编译等场景中,解决在图像优化的过程中可能会因为遍历时间过长导致编译时长不可控的问题,并且提升优化效果。图1示出了本申请实施例中提供的一种数据处理的流程图。从图1可以看出,包括n个输入信息,n为大于等于1的整数,每个输入信息均包括能够表示出输入信息的形状(shape),维度范围(dimensions range),秩(range),以及秩范围(rank range)。通过算子的约束条件对将这n个输入信息进行rank range推导、range推导、shape推导以及dimensions range推导后,得到m个输入信息,m为大于等于1的整数,而每个输出信息中也都包括推导得到的shape、dimensions range、range以及rank range等信息。In order to solve the above problems, the embodiments of the present application provide a situation where the rank of the target data is in an unknown state, or in a situation where the rank is known but the dimension value corresponding to at least one dimension is also in an unknown state, a more accurate deduction can be made. The target arrangement feature of the target data is obtained, so that the data processing device can solve the problem that the compilation time may be uncontrollable due to the long traversal time in the process of image optimization in the subsequent image data compilation and other scenarios based on the target arrangement feature. And improve the optimization effect. FIG. 1 shows a flowchart of a data processing provided in an embodiment of the present application. As can be seen from Figure 1, it includes n input information, n is an integer greater than or equal to 1, and each input information includes a shape that can represent the input information, dimensions range, rank (range), and rank range. After performing rank range derivation, range derivation, shape derivation and dimensions range derivation on the n input information through the constraints of the operator, m pieces of input information are obtained, where m is an integer greater than or equal to 1, and each output information also contains All include the derived shape, dimensions range, range, and rank range and other information.
需说明的是,上述所描述的数据处理可以应用在图像、语音或者自然语言处理等应用场景中。在实际应用中,还可以应用于视频等场景中,此处不做限定说明。It should be noted that the data processing described above can be applied to application scenarios such as image, speech, or natural language processing. In practical applications, it can also be applied to scenarios such as videos, and no limited description is made here.
为了便于更好的理解本申请,请参阅图2,为本申请实施例提供的一种数据处理的方法的示意图,具体如下:In order to facilitate a better understanding of the present application, please refer to FIG. 2 , which is a schematic diagram of a data processing method provided in an embodiment of the present application, as follows:
201、获取至少一个输入信息,其中,每个输入信息均用于表征目标数据的排布特征,排布特征包括第一特征,第一特征的取值为第一值或第一特征的取值为第二值,第一值用于表示未知目标数据的秩,第二值用于表示已知目标数据的秩且未知至少一个维度对应的维度值。201. Acquire at least one input information, wherein each input information is used to represent an arrangement feature of the target data, the arrangement feature includes a first feature, and the value of the first feature is a first value or a value of the first feature is the second value, the first value is used to represent the rank of the unknown target data, the second value is used to represent the rank of the known target data and the dimension value corresponding to at least one dimension is unknown.
实施例中,所描述的目标数据可以包括但不限于图像、语音等数据。In the embodiment, the described target data may include, but not limited to, data such as images and voices.
由于每个输入信息都能够表征同一个目标数据的不同排布特征,而不同的排布特征又反映出目标数据的不同形状,例如:在某些输入信息中只给出了目标数据的秩,且该秩的取值为2,此时数据处理设备在接收该输入信息后,能够获知该目标数据为2维数据;又如,在某些信息中给出了目标数据的秩的取值为4,那么数据处理设备应当获知到该目标数据是4维数据。Since each input information can represent different arrangement features of the same target data, and different arrangement features reflect different shapes of the target data, for example, only the rank of the target data is given in some input information, And the value of the rank is 2. At this time, after receiving the input information, the data processing device can know that the target data is 2-dimensional data; for another example, the value of the rank of the target data is given in some information. 4, then the data processing device should know that the target data is 4-dimensional data.
需要注意的是,排布特征中可以包括第一特征,而该第一特征可以理解成前述所描述的目标数据的秩特征。当某个输入信息中该第一特征的取值为第一值时,就意味着此时并不能直接从该输入信息中获知到目标数据的秩的具体取值,即数据处理设备无法得知该目标数据究竟是几维的数据。应当理解的是,上述所描述的第一值用于表示未知目标数据的秩,该第一值可以取值为-1,或者一个范围,如[1,100]。而在实际应用中,第一值的取值也可以为-2、-3、-4等等无法确定目标数据是几维数据的数值,也可以为#、%、或者&等符号,还可以取其他的范围,如[2,80]等等,此处将不做具体限定。It should be noted that the arrangement feature may include a first feature, and the first feature may be understood as the rank feature of the target data described above. When the value of the first feature in a certain input information is the first value, it means that the specific value of the rank of the target data cannot be directly obtained from the input information at this time, that is, the data processing device cannot know the specific value of the rank of the target data. Exactly how many dimensions of the target data are. It should be understood that the first value described above is used to represent the rank of the unknown target data, and the first value may take a value of -1, or a range, such as [1,100]. In practical applications, the value of the first value can also be -2, -3, -4, etc. It cannot be determined that the target data is a numerical value of several-dimensional data, or it can be a symbol such as #, %, or &, or Take other ranges, such as [2,80], etc., which will not be specifically limited here.
或者,当某个输入信息中该第一特征的取值为第二值时,而该第二值能够用于表示已知目标数据的秩但未知至少一个维度对应的维度值,也意味着数据处理设备能够从该输入信息中得知目标数据具体是几维的数据,但是针对每一维度对应的维度值,该目标算子却无法获知。Or, when the value of the first feature in a certain input information is a second value, and the second value can be used to represent the rank of the known target data but the dimension value corresponding to at least one dimension is unknown, it also means that the data The processing device can know from the input information that the target data is data of several dimensions, but the target operator cannot know the dimension value corresponding to each dimension.
举例来说,某些输入信息中给出了目标数据的其中一种形状(shape),如[-1,80],此时数据处理设备在接收到该输入信息后也能够获知该目标数据的秩为2,即该目标数据是2维数据,并且第二维度对应的维度值为80,而另一个第一维度对应的维度值处于未知状态。 又譬如,若第一特征的取值为[-1,-1],此时数据处理设备能够获知该目标数据的秩为2,但是第一维度与第二维度各自对应的维度值却处于未知状态。For example, one of the shapes of the target data is given in some input information, such as [-1,80]. At this time, the data processing device can also know the shape of the target data after receiving the input information. The rank is 2, that is, the target data is 2-dimensional data, and the dimension value corresponding to the second dimension is 80, while the dimension value corresponding to the other first dimension is in an unknown state. For another example, if the value of the first feature is [-1,-1], the data processing device can know that the rank of the target data is 2, but the dimension values corresponding to the first dimension and the second dimension are unknown. state.
基于此,数据处理设备可以从上一层次的算子中获取至少一个输入信息,例如:从算子1中获取输入信息1,从算子2中获取输入信息2,…从算子n中获取输入信息n(n≥1,且为整数)等等。这样,数据处理设备在得到至少一个输入信息后,便可以根据用户的需求获取目标算子对应的约束条件,以便于基于目标算子的约束条件对至少一个输入信息进行处理。Based on this, the data processing device can obtain at least one input information from the operator at the upper level, for example: obtain input information 1 from operator 1, obtain input information 2 from operator 2, ... obtain input information from operator n Input information n (n≥1, and an integer) and so on. In this way, after obtaining the at least one input information, the data processing device can obtain the constraint condition corresponding to the target operator according to the user's requirement, so as to process the at least one input information based on the constraint condition of the target operator.
202、获取目标算子对应的约束条件,约束条件用于表征目标算子的执行逻辑。202. Acquire a constraint condition corresponding to the target operator, where the constraint condition is used to characterize the execution logic of the target operator.
也就是理解成,数据处理设备在得到用于表征目标数据的排布特征的至少一个输入信息后,可以基于用户的需求获取目标算子对应的约束条件。That is to say, it is understood that, after obtaining at least one input information for characterizing the arrangement feature of the target data, the data processing device can obtain the constraint condition corresponding to the target operator based on the user's requirement.
举例来说,若用户想要从前述所描述的至少一个输入信息中得到取交集后的能够更加能够表明目标数据的目标排布特征,那么此时数据处理设备可以确定目标算子为加法(add)算子,并对获取该加法算子对应的约束条件,即数据处理设备需要获知该目标算子的执行逻辑,例如广播、收缩等操作。值得注意的是,本申请实施例中目标算子除了上述所描述的add算子以外,在实际应用中还可以是其他的算子,如:减法算子(sub)、乘法算子(mul)、指数算子(exp)等等。For example, if the user wants to obtain a target arrangement feature that can better indicate the target data after taking the intersection from the at least one input information described above, then the data processing device can determine that the target operator is an addition (add). ) operator, and obtain the constraints corresponding to the addition operator, that is, the data processing device needs to know the execution logic of the target operator, such as broadcasting, shrinking and other operations. It is worth noting that, in addition to the add operator described above, the target operator in the embodiment of the present application may also be other operators in practical applications, such as a subtraction operator (sub) and a multiplication operator (mul). , the exponential operator (exp), and so on.
203、基于约束条件对至少一个输入信息中第二特征的取值进行处理,得到第一目标值,第一目标值用于反映目标数据中秩的目标范围,其中,排布特征还包括第二特征和第三特征,第二特征的取值为第三值,第三值用于表示秩的范围,第三特征的取值为第四值或第三特征的取值为第五值,第四值用于表示第一特征的取值为第一值时,目标数据的维度总范围,第五值用于表示第一特征的取值为第二值时,每一个维度对应的维度范围。203. Process the value of the second feature in at least one input information based on the constraint condition to obtain a first target value, where the first target value is used to reflect the target range of the rank in the target data, wherein the arrangement feature further includes a second target value. feature and third feature, the value of the second feature is the third value, the third value is used to indicate the range of ranks, the value of the third feature is the fourth value or the value of the third feature is the fifth value, the third value is The four values are used to represent the total dimension range of the target data when the value of the first feature is the first value, and the fifth value is used to represent the dimension range corresponding to each dimension when the value of the first feature is the second value.
实施例中,由于排布特征还可以包括第二特征和第三特征,所描述的第二特征可以理解成秩范围(rank range)特征,而第三特征可以理解成维度范围(dimension range)特征。应理解的是,第二特征的取值可以为第三值,即利用第三值来表示出目标数据的秩的范围。例如,该第三值可以为[2,7]、[3,8]等范围,此处不做限定说明。In the embodiment, since the arrangement feature may also include a second feature and a third feature, the described second feature can be understood as a rank range feature, and the third feature can be understood as a dimension range feature. . It should be understood that the value of the second feature may be a third value, that is, the range of the rank of the target data is represented by the third value. For example, the third value may be in the range of [2, 7], [3, 8], etc., which is not limited here.
而针对第三特征,该第三特征在前述第一特征的取值为不同的值时,也会有相应不同的取值。具体地,当某个输入信息中第一特征的取值为第一值时,由于第一值能够用于表示未知目标数据的秩,那么也很难从所对应的输入信息中获知每一维度对应的维度值,因此该第三特征的取值可以为第四值,由第四值表示出目标数据的维度总范围。例如,在第一值为-2时,那么第四值可以为[50,200]、[30,150]等表示目标数据的秩未知时的维度总范围,此处不做限定说明。For the third feature, when the values of the first feature are different, the third feature also has correspondingly different values. Specifically, when the value of the first feature in a certain input information is the first value, since the first value can be used to represent the rank of the unknown target data, it is difficult to know each dimension from the corresponding input information. Therefore, the value of the third feature may be a fourth value, and the fourth value represents the total dimension range of the target data. For example, when the first value is -2, the fourth value may be [50, 200], [30, 150], etc., indicating the total dimension range when the rank of the target data is unknown, which is not limited here.
或者,当某个输入信息中第一特征的取值为第二值时,由于第二值能够用于指示出已知目标数据的秩但未知至少一个维度对应的维度值,此时第三特征的取值可以为第五值,由第五值指示出每一个维度各自对应的维度范围。例如,在第二值为[-1,-1]时,此时第五值可以为[[1,100],[80,100]];又或者在第二值为[-1,80]时,此时第五值可以为[[1,100],[80,80]]等,此处不做限定说明。Or, when the value of the first feature in a certain input information is the second value, since the second value can be used to indicate the rank of the known target data but the dimension value corresponding to at least one dimension is unknown, the third feature is The value of can be a fifth value, and the fifth value indicates the corresponding dimension range of each dimension. For example, when the second value is [-1,-1], the fifth value can be [[1,100], [80,100]]; or when the second value is [-1,80], then The fifth value may be [[1,100], [80,80]], etc., which is not limited here.
这样,数据处理设备便可以基于约束条件对至少一个输入信息中第二特征的取值进行 处理,以得到第一目标值,而该第一目标值能够指示出秩的目标范围。In this way, the data processing device can process the value of the second feature in the at least one input information based on the constraint condition to obtain the first target value, and the first target value can indicate the target range of the rank.
204、基于约束条件对至少一个输入信息中第一特征的取值、以及第一目标值进行处理,得到第二目标值,第二目标值用于反映秩的目标值。204. Process the value of the first feature and the first target value in the at least one input information based on the constraint condition to obtain a second target value, where the second target value is used to reflect the target value of the rank.
205、基于约束条件对至少一个输入信息中第三特征的取值、以及第二目标值进行处理,得到第三目标值,第三目标值用于反映目标数据的目标维度范围。205. Process the value of the third feature and the second target value in the at least one input information based on the constraint condition to obtain a third target value, where the third target value is used to reflect the target dimension range of the target data.
206、基于第一目标值、第二目标值以及第三目标值得到至少一个输出信息。206. Obtain at least one piece of output information based on the first target value, the second target value, and the third target value.
实施例中,数据处理设备在得到秩的目标范围后,数据处理设备可以进一步地基于约束条件对至少一个输入信息中第一特征的取值以及第一目标值进行处理,以得到第二目标值,由该第二目标值能够表示出秩的目标值然后数据处理设备也基于约束条件对至少一个输入信息中第三特征的取值以及上述的第二目标值确定出第三目标值,由该第三目标值反映出目标数据的目标维度范围。这样,数据处理设备便可以基于第一目标值、第二目标值以及第三目标值得到至少一个输出信息,使得每个输出信息都能够表征出目标数据的目标排布特征。In an embodiment, after the data processing device obtains the target range of the rank, the data processing device may further process the value of the first feature and the first target value in at least one input information based on the constraint condition to obtain the second target value. , the target value of the rank can be represented by the second target value, and then the data processing device also determines the third target value based on the constraint condition on the value of the third feature in the at least one input information and the above-mentioned second target value, and the third target value is determined by the second target value. The third target value reflects the target dimension range of the target data. In this way, the data processing device can obtain at least one output information based on the first target value, the second target value and the third target value, so that each output information can represent the target arrangement feature of the target data.
举例来说,假设以目标数据为图像为例,而且数据处理设备获取到用于表征该图像的排布特征的两个输入信息,分别为:For example, suppose that the target data is an image as an example, and the data processing device obtains two input information used to characterize the arrangement features of the image, respectively:
输入信息1:shape_1:[-1,80],rank_1:2,rank_range_1:[2,2],dimensions range_1:[[1,100],[80,80]];Input information 1: shape_1: [-1,80], rank_1: 2, rank_range_1: [2,2], dimensions range_1: [[1,100],[80,80]];
输入信息2:shape_2:none,rank_2:-2,rank_range_2:[2,7],dimensions range_2:[50,200]。需要说明的是,第一特征的取值为第一值可以理解成输入信息2中的rank_2:-2,而第二值可以理解成输入信息1中的[-1,80];此外,第二特征的取值为第三值可以理解成输入信息1中的rank_range_1:[2,2],以及输入信息2中的rank_range_2:[2,7];第三特征的取值为第四值可以理解成输入信息2中的dimensions range_2:[50,200],而第三特征的取值为第五值可以理解成输入信息1中的dimensions range_1:[[1,100],[80,80]]。Input information 2: shape_2: none, rank_2: -2, rank_range_2: [2,7], dimensions range_2: [50,200]. It should be noted that the value of the first feature can be interpreted as the first value of rank_2:-2 in the input information 2, and the second value can be understood as [-1,80] in the input information 1; in addition, the first The value of the second feature as the third value can be understood as rank_range_1: [2,2] in the input information 1, and rank_range_2: [2,7] in the input information 2; the value of the third feature is the fourth value can be It is understood as the dimensions range_2 in the input information 2: [50, 200], and the value of the third feature is the fifth value can be understood as the dimensions range_1 in the input information 1: [[1, 100], [80, 80]].
因此,在目标算子为add算子的情况下,数据处理设备可以基于add算子中秩范围推导约束条件取rank_range_1:[2,2]与rank_range_2:[2,7]之间的交集,得到第一目标值为rank range_out:[2,2]。然后,数据处理设备基于add算子中秩推导约束条件将第一目标值[2,2]结合rank_2:-2,以及rank_1:2进行处理,得到第二目标值为rank_out:2,此时可以确定出目标数据应当为二维数据。那么,数据处理设备还可以基于add算子中维度范围推导约束条件将dimensions range_1:[[1,100],[80,80]]、dimensions range_2:[50,200]以及第二目标值进行处理,具体地,数据处理设备将dimensions range_1:[[1,100],[80,80]]中的第一维度的维度范围[1,100]与dimensions range_2:[50,200]取交集,得到[50,100],然后将dimensions range_1:[[1,100],[80,80]]中的第二维度的维度范围[80,80]与dimensions range_2:[50,200]取交集,得到[80,80]。这样,最终得到的第三目标值则为dimensions range_out:[[50,100],[80,80]]。Therefore, when the target operator is the add operator, the data processing device can take the intersection between rank_range_1:[2,2] and rank_range_2:[2,7] based on the rank range derivation constraint in the add operator, and obtain The first target value is rank range_out: [2,2]. Then, the data processing device processes the first target value [2, 2] in combination with rank_2: -2 and rank_1: 2 based on the rank derivation constraint in the add operator, and obtains the second target value rank_out: 2. At this time, you can It is determined that the target data should be two-dimensional data. Then, the data processing device can also process the dimensions range_1:[[1,100],[80,80]], the dimensions range_2:[50,200] and the second target value based on the dimension range derivation constraints in the add operator. Specifically, The data processing device intersects the dimension range [1,100] of the first dimension in the dimensions range_1:[[1,100],[80,80]] with the dimensions range_2:[50,200] to obtain [50,100], and then the dimensions range_1:[ The dimension range [80,80] of the second dimension in [1,100],[80,80]] and the dimensions range_2:[50,200] take the intersection to get [80,80]. In this way, the final third target value is dimensions range_out: [[50,100], [80,80]].
基于此,图像的输出信息可以为:rank range_out:[2,2],rank_out:2,以及dimensions range_out:[[50,100],[80,80]]。因此,从输出信息可以获知图像是一个二维图像,并 且能够基于目标算子的约束条件将图像的每一个维度对应的维度范围缩小至[[50,100],[80,80]],为后续图像引擎的优化场景提供了优化基础,减少图像优化的过程中的遍历时长以及编译时长。Based on this, the output information of the image can be: rank range_out: [2, 2], rank_out: 2, and dimensions range_out: [[50, 100], [80, 80]]. Therefore, it can be known from the output information that the image is a two-dimensional image, and the dimension range corresponding to each dimension of the image can be reduced to [[50,100], [80,80]] based on the constraints of the target operator, which is the subsequent image. The optimization scene of the engine provides an optimization basis and reduces the traversal time and compilation time in the process of image optimization.
值得说明的是,该输出信息还可以包括shape_out:[-1,80]。另外,上述仅仅以两个输入信息以及add算子为例进行说明,具体在实际应用中,还可以将基于目标算子的约束条件对一个或多个输入信息进行处理,得到至少一个输出信息,具体可以参照前述add算子的示例进行理解,此处将不做赘述。It is worth noting that the output information may also include shape_out: [-1, 80]. In addition, the above only takes two input information and the add operator as an example for description. Specifically, in practical applications, one or more input information can also be processed based on the constraints of the target operator to obtain at least one output information. The details can be understood with reference to the foregoing example of the add operator, which will not be repeated here.
进一步说明的是,前述所描述的得到至少一个输出信息,针对该输出信息的个数将取决于目标算子的约束条件或约束特性,比如针对relu_grad_v2算子,若对两个输入信息进行处理,那么得到的输出信息为两个,此处将不做具体限定说明。It is further explained that, for obtaining at least one output information described above, the number of the output information will depend on the constraints or constraints of the target operator. For example, for the relu_grad_v2 operator, if two input information is processed, Then the obtained output information is two, which will not be specifically limited here.
示例性的,在一些实施例中,基于约束条件对至少一个输入信息进行处理,得到至少一个输出信息之后,该方法还包括:Exemplarily, in some embodiments, after the at least one input information is processed based on the constraint condition to obtain at least one output information, the method further includes:
基于第一目标值和第三目标值确定对应的输出信息的预分配内存范围。The pre-allocated memory range of the corresponding output information is determined based on the first target value and the third target value.
可理解的是,由于第一目标值能够反映出目标数据中秩的目标范围,而第三目标值能够反映出目标数据的目标维度范围,因此数据处理设备还能够基于第一目标值和第三目标值计算出预存储对应的输出信息需要的内存大小,即预分配内存范围。通过上述方式,能够在图像编译期基于第一目标值与第三目标值提前预分配出所需要的内存范围,相较于在图像运行时期基于已知的秩和维度范围再确定内存范围,能够在运行前更好地优化内存的分配,以便于合理分配内存,减少不必要的内存浪费。举例来说,参阅图3,为本申请实施例中提供的应用于图像的内存分配场景的示意图。从图3可以看出,数据处理设备在获取到图像的输入信息后,基于前述所描述的目标算子的约束条件对输入信息进行处理,得到输出信息,并根据输出信息进行内存预分配。It can be understood that, since the first target value can reflect the target range of ranks in the target data, and the third target value can reflect the target dimension range of the target data, the data processing device can also be based on the first target value and the third target value. The target value calculates the memory size required to pre-store the corresponding output information, that is, the pre-allocated memory range. In the above manner, the required memory range can be pre-allocated in advance based on the first target value and the third target value during image compilation. Better optimize memory allocation before running, so as to allocate memory reasonably and reduce unnecessary memory waste. For example, referring to FIG. 3 , which is a schematic diagram of a memory allocation scenario applied to an image provided in an embodiment of the present application. As can be seen from FIG. 3 , after acquiring the input information of the image, the data processing device processes the input information based on the constraints of the target operator described above to obtain output information, and performs memory pre-allocation according to the output information.
示例性的,在另一些实施例中,前述所描述的数据处理的方法还可以包括:基于第一目标值选取目标模板,目标模板用于优化目标算子。Exemplarily, in other embodiments, the aforementioned data processing method may further include: selecting a target template based on the first target value, and the target template is used to optimize the target operator.
实施例中,由于第一目标值能够反映出目标数据中秩的目标范围,因此数据处理设备还可以从数据库中选择相与第一目标值相匹配的目标模板,剔除不匹配的模板,以便于能够基目标模板对目标算子进行优化和编译优化,以减少目标算子的处理分支,从而选择合适的执行算法,提高目标算子的编译和执行性能。例如,参阅图4,为本申请实施例中提供的应用于图像的编译场景的示意图。从图4可以看出,数据处理设备获取输入信息,基于前述所描述的目标算子的约束条件对输入信息进行处理,得到输出信息,并进一步地调用目标算子提供的编译接口,从而基于第一目标值选择合适的模板进行编译,最后输出编译结果。In the embodiment, since the first target value can reflect the target range of the rank in the target data, the data processing device can also select a target template that matches the first target value from the database, and eliminate unmatched templates, so as to facilitate The target operator can be optimized and compiled based on the target template to reduce the processing branches of the target operator, so as to select an appropriate execution algorithm and improve the compilation and execution performance of the target operator. For example, refer to FIG. 4 , which is a schematic diagram of a compilation scene applied to an image provided in an embodiment of the present application. It can be seen from Figure 4 that the data processing device obtains the input information, processes the input information based on the constraints of the target operator described above, obtains the output information, and further calls the compilation interface provided by the target operator, so as to obtain the output information based on the constraints of the target operator described above. A target value selects an appropriate template for compilation, and finally outputs the compilation result.
207、基于至少一个输出信息中的任意一个输出信息得到目标数据的目标排布特征。207. Obtain a target arrangement feature of the target data based on any one of the at least one output information.
实施例中,在得到至少一个输出信息后,便可以基于任意一个输出信息得到目标数据的目标排布特征,填补了在秩未知或者秩已知但至少一个维度的维度值未知的情况下,无法确定出目标数据的目标排布特征的空白。需要说明的是,该目标排布特征也同样包括上述第一特征、第二特征以及第三特征,而且该目标排布特征中第一特征的取值可以为上述 的第二目标值,而目标排布特征中第二特征的取值为上述的第一目标值,该目标排布特征中第三特征的取值为前述的第三目标值。In the embodiment, after obtaining at least one output information, the target arrangement feature of the target data can be obtained based on any output information, which fills the situation where the rank is unknown or the rank is known but the dimension value of at least one dimension is unknown. The blanks of the target arrangement features of the target data are determined. It should be noted that the target arrangement feature also includes the aforementioned first feature, the second feature and the third feature, and the value of the first feature in the target arrangement feature can be the aforementioned second target value, and the target The value of the second feature in the arrangement features is the aforementioned first target value, and the value of the third feature in the target arrangement feature is the aforementioned third target value.
以上,对本申请实施例提供的一种数据处理的方法进行了介绍,通过本申请实施例提供的方案,可以得到至少一个能够用于表征目标数据的目标排布特征的输出信息,填补了在秩未知或者秩已知但至少一个维度的维度值未知的情况下,无法确定出目标数据的目标排布特征的空白。In the above, a data processing method provided by the embodiments of the present application has been introduced. Through the solutions provided by the embodiments of the present application, at least one output information that can be used to characterize the target arrangement feature of the target data can be obtained, which fills the gap in the rank When the rank is unknown or the rank is known but the dimension value of at least one dimension is unknown, the blank of the target arrangement feature of the target data cannot be determined.
可以理解的是,上述数据处理设备为了实现上述功能,其包含了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该很容易意识到,结合本文中所公开的实施例描述的各示例的模块及算法步骤,本申请能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。It can be understood that, in order to realize the above-mentioned functions, the above-mentioned data processing device includes corresponding hardware structures and/or software modules for executing each function. Those skilled in the art should easily realize that the present application can be implemented in hardware or in the form of a combination of hardware and computer software. Whether a function is performed by hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of this application.
从硬件结构上来描述,图1至图4中的数据处理设备可以由一个实体设备实现,也可以由多个实体设备共同实现,还可以是一个实体设备内的一个逻辑功能模块,本申请实施例对此不作具体限定。Describing from the hardware structure, the data processing device in FIG. 1 to FIG. 4 may be implemented by one entity device, may also be implemented jointly by multiple entity devices, or may be a logic function module in one entity device. This embodiment of the present application This is not specifically limited.
例如,图5所示为本申请实施例提供的数据处理设备的硬件结构示意图。包括:通信接口501和处理器502,还可以包括存储器503。For example, FIG. 5 shows a schematic diagram of a hardware structure of a data processing device provided by an embodiment of the present application. It includes: a communication interface 501 and a processor 502 , and may also include a memory 503 .
通信接口501可以使用任何收发器一类的装置,用于与其他设备或通信网络通信,如以太网,无线接入网(radio access network,RAN),无线局域网(wireless local area networks,WLAN)等。The communication interface 501 can use any transceiver-like device for communicating with other devices or communication networks, such as Ethernet, radio access network (RAN), wireless local area networks (WLAN), etc. .
处理器502包括但不限于中央处理器(central processing unit,CPU),网络处理器(network processor,NP),专用集成电路(application-specific integrated circuit,ASIC)或者可编程逻辑器件(programmable logic device,PLD)中的一个或多个。上述PLD可以是复杂可编程逻辑器件(complex programmable logic device,CPLD),现场可编程逻辑门阵列(field-programmable gate array,FPGA),通用阵列逻辑(generic array logic,GAL)或其任意组合。处理器502负责通信线路504和通常的处理,还可以提供各种功能,包括定时,外围接口,电压调节,电源管理以及其他控制功能。存储器503可以用于存储处理器502在执行操作时所使用的数据。The processor 502 includes but is not limited to a central processing unit (CPU), a network processor (NP), an application-specific integrated circuit (ASIC) or a programmable logic device (programmable logic device, PLD) one or more. The above-mentioned PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a general-purpose array logic (generic array logic, GAL) or any combination thereof. Processor 502 is responsible for communication lines 504 and general processing, and may also provide various functions including timing, peripheral interface, voltage regulation, power management, and other control functions. Memory 503 may be used to store data used by processor 502 in performing operations.
存储器503可以是只读存储器(read-only memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(random access memory,RAM)或者可存储信息和指令的其他类型的动态存储设备,也可以是电可擦可编程只读存储器(electrically er服务器able programmable read-only memory,EEPROM)、只读光盘(compact disc read-only memory,CD-ROM)或其他光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质或者其他磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。存储器可以是独立存在,通过通信线路504与处理器502相连接。存储器503也可以和处理器502集成在一起。如果存储器503和处理器502是相互独立的器件,存储器503和处 理器502相连,例如存储器503和处理器502可以通过通信线路504通信。通信接口501和处理器502可以通过通信线路504通信,通信接口501也可以与处理器502直连。 Memory 503 may be read-only memory (ROM) or other types of static storage devices that can store static information and instructions, random access memory (RAM), or other types of information and instructions It can also be an electrically erasable programmable read-only memory (electrically programmable read-only memory, EEPROM), a compact disc read-only memory (CD-ROM) or other optical disk storage, Optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or capable of carrying or storing desired program code in the form of instructions or data structures and capable of Any other medium that can be accessed by a computer, but is not limited to this. The memory may exist independently and be connected to the processor 502 through the communication line 504 . The memory 503 may also be integrated with the processor 502 . If the memory 503 and the processor 502 are separate devices from each other, the memory 503 and the processor 502 are connected, for example, the memory 503 and the processor 502 may communicate through a communication line 504. The communication interface 501 and the processor 502 can communicate through a communication line 504 , and the communication interface 501 can also be directly connected to the processor 502 .
通信线路504可以包括任意数量的互联的总线和桥,通信线路504将包括由处理器502代表的一个或多个处理器502和存储器503代表的存储器的各种电路链接在一起。通信线路504还可以将诸如外围设备、稳压器和功率管理电路等之类的各种其他电路链接在一起,这些都是本领域所公知的,因此,本申请不再对其进行进一步描述。 Communication lines 504 , which may include any number of interconnected buses and bridges, link together various circuits including one or more processors 502 , represented by processor 502 , and memory, represented by memory 503 . Communication lines 504 may also link together various other circuits such as peripherals, voltage regulators, and power management circuits, etc., which are well known in the art and, therefore, will not be described further herein.
在一个具体的实施方式中,该数据处理设备,可以包括:存储器,用于存储计算机可读指令。还可以包括和存储器耦合的通信接口,用于获取至少一个输入信息,其中,每个输入信息均用于表征目标数据的排布特征,排布特征包括第一特征,第一特征的取值为第一值或第一特征的取值为第二值,第一值用于表示未知目标数据的秩,第二值用于表示已知目标数据的秩且未知至少一个维度对应的维度值;以及获取目标算子对应的约束条件,约束条件用于表征目标算子的执行逻辑。还包括:与通信接口耦合的处理器,用于执行存储器中的计算机可读指令从而执行以下操作:基于约束条件对至少一个输入信息进行处理,得到至少一个输出信息,每个输出信息均用于表征目标数据的目标排布特征,目标排布特征的取值包括第一特征的目标值。In a specific embodiment, the data processing device may include: a memory for storing computer-readable instructions. It may also include a communication interface coupled with the memory for acquiring at least one input information, wherein each input information is used to characterize the arrangement feature of the target data, the arrangement feature includes a first feature, and the value of the first feature is The value of the first value or the first feature is a second value, the first value is used to represent the rank of the unknown target data, the second value is used to represent the rank of the known target data and the dimension value corresponding to at least one dimension is unknown; and Obtain the constraints corresponding to the target operator, and the constraints are used to represent the execution logic of the target operator. Also included: a processor coupled with the communication interface for executing computer-readable instructions in the memory to perform the following operations: process at least one input message based on constraints to obtain at least one output message, each output message for use in The target arrangement feature of the target data is represented, and the value of the target arrangement feature includes the target value of the first feature.
在一个具体的实施方式中,排布特征还包括第二特征和第三特征,第二特征的取值为第三值,第三值用于表示秩的范围,第三特征的取值为第四值或第三特征的取值为第五值,第四值用于表示第一特征的取值为第一值时,目标数据的维度总范围,第五值用于表示第一特征的取值为第二值时,每一个维度对应的维度范围;处理器,具体用于:基于约束条件对至少一个输入信息中第二特征的取值进行处理,得到第一目标值,第一目标值用于反映目标数据中秩的目标范围;基于约束条件对至少一个输入信息中第一特征的取值、以及第一目标值进行处理,得到第二目标值,第二目标值用于反映秩的目标值;基于约束条件对至少一个输入信息中第三特征的取值、以及第二目标值进行处理,得到第三目标值,第三目标值用于反映目标数据的目标维度范围;基于第一目标值、第二目标值以及第三目标值得到至少一个输出信息。In a specific embodiment, the arrangement feature further includes a second feature and a third feature, the value of the second feature is a third value, the third value is used to represent the range of ranks, and the value of the third feature is the third value The value of the fourth value or the third feature is the fifth value, the fourth value is used to represent the total dimension range of the target data when the value of the first feature is the first value, and the fifth value is used to represent the value of the first feature. When the value is the second value, the dimension range corresponding to each dimension; the processor is specifically used for: processing the value of the second feature in at least one input information based on the constraint condition to obtain the first target value, the first target value It is used to reflect the target range of the rank in the target data; the value of the first feature and the first target value in at least one input information are processed based on the constraints to obtain a second target value, and the second target value is used to reflect the rank. target value; process the value of the third feature and the second target value in at least one input information based on the constraint condition to obtain a third target value, and the third target value is used to reflect the target dimension range of the target data; based on the first At least one output information is obtained from the target value, the second target value and the third target value.
在一个具体的实施方式中,处理器,还用于:基于约束条件对至少一个输入信息进行处理,得到至少一个输出信息之后,基于第一目标值和第三目标值确定对应的输出信息的预分配内存范围。In a specific embodiment, the processor is further configured to: process at least one input information based on a constraint condition, and after obtaining at least one output information, determine a prediction of the corresponding output information based on the first target value and the third target value Allocate a memory range.
在一个具体的实施方式中,处理器,具体用于:基于第一目标值选取目标模板,目标模板用于优化目标算子。In a specific implementation manner, the processor is specifically configured to: select a target template based on the first target value, and the target template is used to optimize the target operator.
在一个具体的实施方式中,处理器,具体用于:基于至少一个输出信息中的任意一个输出信息得到目标数据的目标排布特征,其中,目标排布特征包括第一特征、第二特征以及第三特征,目标排布特征中第一特征的取值为第二目标值,目标排布特征中第二特征的取值为第一目标值,目标排布特征中第三特征的取值为第三目标值。In a specific embodiment, the processor is specifically configured to: obtain a target arrangement feature of the target data based on any one of the at least one output information, wherein the target arrangement feature includes a first feature, a second feature and The third feature, the value of the first feature in the target arrangement feature is the second target value, the value of the second feature in the target arrangement feature is the first target value, and the value of the third feature in the target arrangement feature is the value third target value.
在一个具体的实施方式中,第一值为符号或用于表示秩未知的数值。In a specific embodiment, the first value is a symbol or a numerical value used to indicate that the rank is unknown.
参见图6,是本申请实施例提供的一种执行设备的结构示意图。如图6所示,执行设备可以包括处理器601、存储器602、通信总线603、通信接口604,人工智能处理器605 通过通信总线603连接存储器602和通信接口604。Referring to FIG. 6 , it is a schematic structural diagram of an execution device provided by an embodiment of the present application. As shown in FIG. 6 , the execution device may include a processor 601 , a memory 602 , a communication bus 603 , and a communication interface 604 , and the artificial intelligence processor 605 is connected to the memory 602 and the communication interface 604 through the communication bus 603 .
处理器601可以是中央处理单元(central processing unit,CPU),该处理器601还可以是其他通用处理器、数字信号处理器(digital signal processor,DSP)、专用集成电路(application specific integrated circuit,ASIC)、现成可编程门阵列(field-programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。处理器601可以是微处理器或者该处理器601也可以是任何常规的处理器等。The processor 601 may be a central processing unit (CPU), and the processor 601 may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs) ), off-the-shelf programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The processor 601 may be a microprocessor or the processor 601 may be any conventional processor or the like.
处理器601还可以是一种集成电路芯片,具有信号的处理能力。在实现过程中,本申请的数据处理的方法的各个步骤可以通过处理器601中的硬件的集成逻辑电路或者软件形式的指令完成。The processor 601 may also be an integrated circuit chip, which has signal processing capability. In the implementation process, each step of the data processing method of the present application may be completed by an integrated logic circuit of hardware in the processor 601 or instructions in the form of software.
存储器602可以是只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)或其他存储器。本申请实施例中,存储器602用于存储数据以及各种软件程序。The memory 602 may be read-only memory (ROM), random access memory (RAM), or other memory. In this embodiment of the present application, the memory 602 is used for storing data and various software programs.
可选的,在本申请实施例中,存储器602可以包括用于存储信息的物理装置,通常是将信息数字化后再以利用电、磁或者光学等方法的媒体加以存储。本实施方式的存储器又可以包括:利用电能方式存储信息的装置,如RAM、ROM等;利用磁能方式存储信息的装置,如硬盘、软盘、磁带、磁芯存储器、磁泡存储器、U盘;利用光学方式存储信息的装置,如CD或DVD。当然,还有其他方式的存储器,例如量子存储器、石墨烯存储器等等。Optionally, in this embodiment of the present application, the memory 602 may include a physical device for storing information, and usually the information is digitized and then stored in a medium using electrical, magnetic, or optical methods. The memory of this embodiment may further include: devices that use electrical energy to store information, such as RAM, ROM, etc.; devices that use magnetic energy to store information, such as hard disks, floppy disks, magnetic tapes, magnetic core memory, magnetic bubble memory, U disk; use A device that stores information optically, such as a CD or DVD. Of course, there are other ways of memory, such as quantum memory, graphene memory, and so on.
通信接口604使用例如但不限于收发器一类的收发装置,来实现执行设备与其他设备或通信网络之间的通信。例如,可以通过通信接口604接收至少一个输入信息等。The communication interface 604 uses transceiving means such as, but not limited to, a transceiver to enable communication between the executing device and other devices or a communication network. For example, at least one input message or the like may be received via the communication interface 604 .
可选地,该执行设备还可以包括至少一个人工智能处理器605。Optionally, the execution device may further include at least one artificial intelligence processor 605 .
人工智能处理器605可以作为协处理器挂载到主CPU(host CPU)上,由主CPU为其分配任务。在实际应用中,人工智能处理器605可以实现一种或多种运算。例如,以神经网络处理器(network processing Unit,NPU)NPU为例,NPU的核心部分为运算电路,通过控制器控制运算电路提取存储器602中的矩阵数据并进行乘加运算。The artificial intelligence processor 605 can be mounted on the main CPU (host CPU) as a co-processor, and the main CPU assigns tasks to it. In practical applications, the artificial intelligence processor 605 may implement one or more operations. For example, taking a neural network processor (network processing unit, NPU) NPU as an example, the core part of the NPU is an arithmetic circuit, and the controller controls the arithmetic circuit to extract the matrix data in the memory 602 and perform multiplication and addition operations.
可选的,人工智能处理器605可以包括8个集群(cluster),每个cluster中包括4个人工智能处理器核。Optionally, the artificial intelligence processor 605 may include 8 clusters (clusters), and each cluster includes 4 artificial intelligence processor cores.
可选的,人工智能处理器605可以是可重构体系结构的人工智能处理器。这里,可重构体系结构是指,如果某一人工智能处理器能够利用可重用的硬件资源,根据不同的应用需求,灵活的改变自身的体系结构,以便为每个特定的应用需求提供与之相匹配的体系结构,那么这一人工智能处理器就称为可重构的计算系统,其体系结构称为可重构的体系结构。Optionally, the artificial intelligence processor 605 may be an artificial intelligence processor with a reconfigurable architecture. Here, the reconfigurable architecture refers to that if an artificial intelligence processor can utilize reusable hardware resources and flexibly change its own architecture according to different application requirements, in order to provide corresponding requirements for each specific application If it matches the architecture, the artificial intelligence processor is called a reconfigurable computing system, and its architecture is called a reconfigurable architecture.
应当理解,执行设备仅为本申请实施例提供的一个例子,并且,执行设备可具有比示出的部件更多或更少的部件,可以组合两个或更多个部件,或者可具有部件的不同配置实现。It should be understood that the execution device is only an example provided by the embodiments of the present application, and the execution device may have more or less components than those shown, may combine two or more components, or may have a combination of components Different configurations are implemented.
上述主要从实体功能的角度描述了本申请实施例中提供的数据处理设备。从功能单元的角度,本申请可以根据上述方法实施例对数据处理设备进行功能单元的划分,例如,可 以对应各个功能划分各个功能单元,也可以将两个或两个以上的功能集成在一个功能单元中。上述集成的功能单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。The above description mainly describes the data processing device provided in the embodiments of the present application from the perspective of entity functions. From the perspective of functional units, the present application may divide the data processing device into functional units according to the above method embodiments. For example, each functional unit may be divided corresponding to each function, or two or more functions may be integrated into one function. in the unit. The above-mentioned integrated functional units may be implemented in the form of hardware, and may also be implemented in the form of software functional units.
比如,以采用集成的方式划分各个功能单元的情况下,图7示出了本申请实施例提供的一种数据处理设备的结构示意图。如图7所示,本申请的数据处理设备的一个实施例可以包括:For example, in the case of dividing each functional unit in an integrated manner, FIG. 7 shows a schematic structural diagram of a data processing device provided by an embodiment of the present application. As shown in FIG. 7, an embodiment of the data processing device of the present application may include:
编程接口模块701,用于获取至少一个输入信息,其中,每个输入信息均用于表征目标数据的排布特征,排布特征包括第一特征,第一特征的取值为第一值或第一特征的取值为第二值,第一值用于表示未知目标数据的秩,第二值用于表示已知目标数据的秩且未知至少一个维度对应的维度值;The programming interface module 701 is used to obtain at least one input information, wherein each input information is used to represent the arrangement feature of the target data, the arrangement feature includes a first feature, and the value of the first feature is a first value or a first value. The value of a feature is a second value, the first value is used to represent the rank of the unknown target data, the second value is used to represent the rank of the known target data and the dimension value corresponding to at least one dimension is unknown;
编程接口模块701,用于获取目标算子对应的约束条件,约束条件用于表征目标算子的执行逻辑;The programming interface module 701 is used to obtain the constraint condition corresponding to the target operator, and the constraint condition is used to characterize the execution logic of the target operator;
处理模块702,用于基于约束条件对至少一个输入信息进行处理,得到至少一个输出信息,每个输出信息均用于表征目标数据的目标排布特征,目标排布特征的取值包括第一特征的目标值。The processing module 702 is configured to process at least one input information based on the constraint condition to obtain at least one output information, each output information is used to characterize the target arrangement feature of the target data, and the value of the target arrangement feature includes the first feature target value.
在一些实施例中,排布特征还包括第二特征和第三特征,第二特征的取值为第三值,第三值用于表示秩的范围,第三特征的取值为第四值或第三特征的取值为第五值,第四值用于表示第一特征的取值为第一值时,目标数据的维度总范围,第五值用于表示第一特征的取值为第二值时,每一个维度对应的维度范围;处理模块702,具体用于:In some embodiments, the arrangement feature further includes a second feature and a third feature, the second feature is a third value, the third value is used to represent a rank range, and the third feature is a fourth value Or the value of the third feature is the fifth value, the fourth value is used to represent the total dimension range of the target data when the value of the first feature is the first value, and the fifth value is used to represent the value of the first feature. When the second value is the dimension range corresponding to each dimension; the processing module 702 is specifically used for:
根据约束条件对至少一个输入信息中第二特征的取值进行处理,得到第一目标值,第一目标值用于反映目标数据中秩的目标范围;The value of the second feature in at least one input information is processed according to the constraint condition to obtain a first target value, and the first target value is used to reflect the target range of the rank in the target data;
根据约束条件对至少一个输入信息中第一特征的取值、以及第一目标值进行处理,得到第二目标值,第二目标值用于反映秩的目标值;The value of the first feature and the first target value in the at least one input information are processed according to the constraint condition to obtain the second target value, and the second target value is used to reflect the target value of the rank;
根据约束条件对至少一个输入信息中第三特征的取值、以及第二目标值进行处理,得到第三目标值,第三目标值用于范围目标数据的目标维度范围;The value of the third feature and the second target value in the at least one input information are processed according to the constraint condition to obtain the third target value, and the third target value is used for the target dimension range of the range target data;
根据第一目标值、第二目标值以及第三目标值得到至少一个输出信息。At least one output information is obtained according to the first target value, the second target value and the third target value.
在一些实施例中,处理模块702,还具体用于:在基于约束条件对至少一个信息进行处理,得到至少一个输出信息之后,基于第一目标值和第三目标值确定对应输出信息的预分配内存范围。In some embodiments, the processing module 702 is further specifically configured to: after the at least one piece of information is processed based on the constraint condition to obtain at least one piece of output information, determine the pre-allocation of the corresponding output information based on the first target value and the third target value memory range.
在一些实施例中,处理模块702,用于根据第一目标值选取目标模板,目标模板用于优化目标算子。In some embodiments, the processing module 702 is configured to select a target template according to the first target value, and the target template is used to optimize the target operator.
在另一些实施例中,处理模块702,还用于基于至少一个输出信息中的任意一个输出信息得到目标数据的目标排布特征,其中,目标排布特征包括第一特征、第二特征以及第三特征,目标排布特征中第一特征的取值为第二目标值,目标排布特征中第二特征的取值为第一目标值,目标排布特征中第三特征的取值为第三目标值。In other embodiments, the processing module 702 is further configured to obtain a target arrangement feature of the target data based on any one of the at least one output information, wherein the target arrangement feature includes a first feature, a second feature, and a first feature. Three features, the value of the first feature in the target arrangement feature is the second target value, the value of the second feature in the target arrangement feature is the first target value, and the value of the third feature in the target arrangement feature is the first target value Three target values.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。In the above-mentioned embodiments, it may be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented in software, it can be implemented in whole or in part in the form of a computer program product.
计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行计算机程序指令时,全部或部分地产生按照本申请实施例的流程或功能。计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一计算机可读存储介质传输,例如,计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。计算机可读存储介质可以是计算机能够存储的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid State Disk(SSD))等。A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the procedures or functions according to the embodiments of the present application are generated in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable device. Computer instructions may be stored on or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server, or data center over a wire (e.g. coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (eg, infrared, wireless, microwave, etc.) to another website site, computer, server, or data center. The computer-readable storage medium can be any available medium that can be stored by a computer or a data storage device such as a server, a data center, etc. that includes one or more available media integrated. Useful media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVD), or semiconductor media (eg, Solid State Disk (SSD)), among others.
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存储介质中,存储介质可以包括:ROM、RAM、磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing relevant hardware through a program, and the program can be stored in a computer-readable storage medium, and the storage medium can include: ROM, RAM, magnetic disk or optical disk, etc.
以上对本申请实施例所提供的数据处理的方法、以及相关设备进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上,本说明书内容不应理解为对本申请的限制。The data processing method and related equipment provided by the embodiments of the present application have been described in detail above. The principles and implementations of the present application are described with specific examples in this article. The method of the application and its core idea; meanwhile, for those skilled in the art, according to the idea of the application, there will be changes in the specific embodiments and application scope. Application restrictions.
Claims (15)
- 一种数据处理的方法,其特征在于,包括:A method for data processing, comprising:获取至少一个输入信息,其中,每个所述输入信息均用于表征目标数据的排布特征,所述排布特征包括第一特征,所述第一特征的取值为第一值或所述第一特征的取值为第二值,所述第一值用于表示未知所述目标数据的秩,所述第二值用于表示所述已知所述目标数据的秩且未知至少一个维度对应的维度值;Acquire at least one input information, wherein each of the input information is used to represent an arrangement feature of the target data, the arrangement feature includes a first feature, and the value of the first feature is a first value or the The value of the first feature is a second value, the first value is used to represent the unknown rank of the target data, the second value is used to represent the known rank of the target data and at least one dimension is unknown the corresponding dimension value;获取目标算子对应的约束条件,所述约束条件用于表征所述目标算子的执行逻辑;Obtaining constraints corresponding to the target operator, where the constraints are used to characterize the execution logic of the target operator;基于所述约束条件对所述至少一个输入信息进行处理,得到至少一个输出信息,每个所述输出信息均用于表征所述目标数据的目标排布特征,所述目标排布特征的取值包括所述第一特征的目标值。The at least one input information is processed based on the constraint condition to obtain at least one output information, each of the output information is used to represent the target arrangement feature of the target data, and the value of the target arrangement feature A target value for the first feature is included.
- 根据权利要求1所述的方法,其特征在于,所述排布特征还包括第二特征和第三特征,所述第二特征的取值为第三值,所述第三值用于表示所述秩的范围,所述第三特征的取值为第四值或所述第三特征的取值为第五值,所述第四值用于表示所述第一特征的取值为第一值时,所述目标数据的维度总范围,所述第五值用于表示所述第一特征的取值为第二值时,每一个维度对应的维度范围;The method according to claim 1, wherein the arrangement feature further comprises a second feature and a third feature, the value of the second feature is a third value, and the third value is used to represent the The range of the rank, the value of the third feature is the fourth value or the value of the third feature is the fifth value, and the fourth value is used to indicate that the value of the first feature is the first value value, the total dimension range of the target data, and the fifth value is used to indicate the dimension range corresponding to each dimension when the value of the first feature is the second value;基于所述约束条件对所述至少一个输入信息,得到至少一个输出信息,包括:Obtain at least one output information for the at least one input information based on the constraint condition, including:基于所述约束条件对所述至少一个输入信息中第二特征的取值进行处理,得到第一目标值,所述第一目标值用于反映所述目标数据中秩的目标范围;processing the value of the second feature in the at least one input information based on the constraint condition to obtain a first target value, where the first target value is used to reflect the target range of ranks in the target data;基于所述约束条件对所述至少一个输入信息中第一特征的取值、以及所述第一目标值进行处理,得到第二目标值,所述第二目标值用于反映所述秩的目标值;The value of the first feature in the at least one input information and the first target value are processed based on the constraint condition to obtain a second target value, where the second target value is used to reflect the target of the rank value;基于所述约束条件对所述至少一个输入信息中第三特征的取值、以及所述第二目标值进行处理,得到第三目标值,所述第三目标值用于反映所述目标数据的目标维度范围;Based on the constraint condition, the value of the third feature in the at least one input information and the second target value are processed to obtain a third target value, and the third target value is used to reflect the target data. target dimension range;基于所述第一目标值、所述第二目标值以及所述第三目标值得到至少一个输出信息。At least one output information is obtained based on the first target value, the second target value and the third target value.
- 根据权利要求2所述的方法,其特征在于,基于所述约束条件对所述至少一个输入信息进行处理,得到至少一个输出信息之后,所述方法还包括:The method according to claim 2, wherein after processing the at least one input information based on the constraint condition to obtain at least one output information, the method further comprises:基于所述第一目标值和所述第三目标值确定对应的输出信息的预分配内存范围。The pre-allocated memory range of the corresponding output information is determined based on the first target value and the third target value.
- 根据权利要求2或3所述的处理方法,其特征在于,所述处理方法还包括:The processing method according to claim 2 or 3, wherein the processing method further comprises:基于所述第一目标值选取目标模板,所述目标模板用于优化所述目标算子。A target template is selected based on the first target value, and the target template is used to optimize the target operator.
- 根据权利要求2-4中任一项所述的处理方法,其特征在于,所述处理方法还包括:The processing method according to any one of claims 2-4, wherein the processing method further comprises:基于所述至少一个输出信息中的任意一个输出信息得到所述目标数据的目标排布特征,其中,所述目标排布特征包括所述第一特征、第二特征以及第三特征,所述目标排布特征中第一特征的取值为所述第二目标值,所述目标排布特征中第二特征的取值为所述第一目标值,所述目标排布特征中第三特征的取值为所述第三目标值。A target arrangement feature of the target data is obtained based on any one of the at least one output information, wherein the target arrangement feature includes the first feature, the second feature, and the third feature, and the target The value of the first feature in the arrangement feature is the second target value, the value of the second feature in the target arrangement feature is the first target value, and the value of the third feature in the target arrangement feature is The value is the third target value.
- 根据权利要求1-5中任一项所述的方法,其特征在于,所述第一值为符号或用于表示秩未知的数值。The method according to any one of claims 1-5, wherein the first value is a symbol or a numerical value used to indicate that the rank is unknown.
- 一种数据处理设备,其特征在于,包括:A data processing device, comprising:编程接口模块,用于获取至少一个输入信息,其中,每个所述输入信息均用于表征目 标数据的排布特征,所述排布特征包括第一特征,所述第一特征的取值为第一值或所述第一特征的取值为第二值,所述第一值用于表示未知所述目标数据的秩,所述第二值用于表示所述已知所述目标数据的秩且未知至少一个维度对应的维度值;A programming interface module for acquiring at least one input information, wherein each of the input information is used to represent an arrangement feature of the target data, the arrangement feature includes a first feature, and the value of the first feature is The first value or the value of the first feature is a second value, where the first value is used to represent the rank of the unknown target data, and the second value is used to represent the known rank of the target data. rank and the dimension value corresponding to at least one dimension is unknown;所述编程接口模块,用于获取目标算子对应的约束条件,所述约束条件用于表征所述目标算子的执行逻辑;The programming interface module is used to obtain constraints corresponding to the target operator, where the constraints are used to characterize the execution logic of the target operator;处理模块,用于基于所述约束条件对所述至少一个输入信息进行处理,得到至少一个输出信息,每个所述输出信息均用于表征所述目标数据的目标排布特征,所述目标排布特征的取值包括所述第一特征的目标值。A processing module, configured to process the at least one input information based on the constraint condition to obtain at least one output information, each of the output information is used to characterize the target arrangement feature of the target data, the target arrangement The value of the cloth feature includes the target value of the first feature.
- 根据权利要求7所述的数据处理设备,其特征在于,所述排布特征还包括第二特征和第三特征,所述第二特征的取值为第三值,所述第三值用于表示所述秩的范围,所述第三特征的取值为第四值或所述第三特征的取值为第五值,所述第四值用于表示所述第一特征的取值为第一值时,所述目标数据的维度总范围,所述第五值用于表示所述第一特征的取值为第二值时,每一个维度对应的维度范围;The data processing device according to claim 7, wherein the arrangement feature further comprises a second feature and a third feature, and the value of the second feature is a third value, and the third value is used for Indicates the range of the rank, the value of the third feature is the fourth value or the value of the third feature is the fifth value, and the fourth value is used to indicate that the value of the first feature is the value When the first value is the total dimension range of the target data, the fifth value is used to indicate the dimension range corresponding to each dimension when the value of the first feature is the second value;所述处理模块,用于:The processing module is used for:根据所述约束条件对所述至少一个输入信息中第二特征的取值进行处理,得到第一目标值,所述第一目标值用于反映所述目标数据中秩的目标范围;The value of the second feature in the at least one input information is processed according to the constraint condition to obtain a first target value, where the first target value is used to reflect the target range of ranks in the target data;根据所述约束条件对所述至少一个输入信息中第一特征的取值、以及所述第一目标值进行处理,得到第二目标值,所述第二目标值用于反映所述秩的目标值;The value of the first feature in the at least one input information and the first target value are processed according to the constraint condition to obtain a second target value, where the second target value is used to reflect the target of the rank value;根据所述约束条件对所述至少一个输入信息中第三特征的取值、以及所述第二目标值进行处理,得到第三目标值,所述第三目标值用于范围所述目标数据的目标维度范围;The value of the third feature in the at least one input information and the second target value are processed according to the constraint condition to obtain a third target value, and the third target value is used to range the target data. target dimension range;根据所述第一目标值、所述第二目标值以及所述第三目标值得到至少一个输出信息。At least one output information is obtained according to the first target value, the second target value and the third target value.
- 根据权利要求8所述的数据处理设备,其特征在于,所述处理模块,还用于在基于所述约束条件对所述至少一个信息进行处理,得到至少一个输出信息之后,基于所述第一目标值和所述第三目标值确定对应输出信息的预分配内存范围。The data processing device according to claim 8, wherein the processing module is further configured to process the at least one piece of information based on the constraint condition to obtain at least one output piece of information, based on the first The target value and the third target value determine a pre-allocated memory range corresponding to the output information.
- 根据权利要求8或9所述的数据处理设备,其特征在于,所述处理模块,用于根据所述第一目标值选取目标模板,所述目标模板用于优化所述目标算子。The data processing device according to claim 8 or 9, wherein the processing module is configured to select a target template according to the first target value, and the target template is used to optimize the target operator.
- 根据权利要求8-10中任一项所述的数据处理设备,其特征在于,所述处理模块,还用于基于所述至少一个输出信息中的任意一个输出信息得到所述目标数据的目标排布特征,其中,所述目标排布特征包括所述第一特征、第二特征以及第三特征,所述目标排布特征中第一特征的取值为所述第二目标值,所述目标排布特征中第二特征的取值为所述第一目标值,所述目标排布特征中第三特征的取值为所述第三目标值。The data processing device according to any one of claims 8-10, wherein the processing module is further configured to obtain a target arrangement of the target data based on any one of the at least one output information. distribution feature, wherein the target distribution feature includes the first feature, the second feature and the third feature, the value of the first feature in the target distribution feature is the second target value, the target The value of the second feature in the arrangement features is the first target value, and the value of the third feature in the target arrangement feature is the third target value.
- 根据权利要求8-11中任一项所述的数据处理设备,其特征在于,所述第一值为符号或用于表示秩未知的数值。The data processing device according to any one of claims 8-11, wherein the first value is a symbol or a numerical value used to represent an unknown rank.
- 一种数据处理设备,其特征在于,包括:A data processing device, comprising:存储器,用于存储计算机可读指令;memory for storing computer-readable instructions;还包括,与所述存储器耦合的处理器,用于执行所述存储器中的计算机可读指令从而执行如权利要求1至6任一项所描述的方法。Also included, a processor coupled to the memory for executing computer readable instructions in the memory to perform the method as described in any one of claims 1-6.
- 一种计算机可读存储介质,其特征在于,当指令在计算机装置上运行时,使得所述计算机装置执行如权利要求1至6任一项所描述的方法。A computer-readable storage medium, wherein the instructions, when executed on a computer device, cause the computer device to perform the method described in any one of claims 1 to 6.
- 一种计算机程序产品,当在计算机上运行时,使得计算机可以执行如权利要求1至6任一所描述的方法。A computer program product which, when run on a computer, enables the computer to perform a method as described in any one of claims 1 to 6.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2020/131120 WO2022109779A1 (en) | 2020-11-24 | 2020-11-24 | Data processing method and related device |
CN202080107278.2A CN116670688A (en) | 2020-11-24 | 2020-11-24 | Data processing method and related equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2020/131120 WO2022109779A1 (en) | 2020-11-24 | 2020-11-24 | Data processing method and related device |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2022109779A1 true WO2022109779A1 (en) | 2022-06-02 |
Family
ID=81755235
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2020/131120 WO2022109779A1 (en) | 2020-11-24 | 2020-11-24 | Data processing method and related device |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN116670688A (en) |
WO (1) | WO2022109779A1 (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101493886A (en) * | 2009-02-24 | 2009-07-29 | 武汉兰丁医学高科技有限公司 | Karyoplast categorization and identification method in case of unsoundness of characteristic parameter |
CN110006568A (en) * | 2019-04-12 | 2019-07-12 | 中国地质科学院地质力学研究所 | It is a kind of to obtain the method for three-dimensional ground stress using core and its obtain system |
CN110490309A (en) * | 2019-08-14 | 2019-11-22 | 北京中科寒武纪科技有限公司 | A kind of Operator Fusion method and its Related product for neural network |
US20200211276A1 (en) * | 2018-12-29 | 2020-07-02 | Dassault Systemes | Learning a neural network for inference of editable feature trees |
-
2020
- 2020-11-24 CN CN202080107278.2A patent/CN116670688A/en active Pending
- 2020-11-24 WO PCT/CN2020/131120 patent/WO2022109779A1/en active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101493886A (en) * | 2009-02-24 | 2009-07-29 | 武汉兰丁医学高科技有限公司 | Karyoplast categorization and identification method in case of unsoundness of characteristic parameter |
US20200211276A1 (en) * | 2018-12-29 | 2020-07-02 | Dassault Systemes | Learning a neural network for inference of editable feature trees |
CN110006568A (en) * | 2019-04-12 | 2019-07-12 | 中国地质科学院地质力学研究所 | It is a kind of to obtain the method for three-dimensional ground stress using core and its obtain system |
CN110490309A (en) * | 2019-08-14 | 2019-11-22 | 北京中科寒武纪科技有限公司 | A kind of Operator Fusion method and its Related product for neural network |
Non-Patent Citations (1)
Title |
---|
ARTIFICIAL INTELLIGENCE MEETS PANCHUANG: "Understanding Input and Output Shapes in Convolutional Neural Networks (Keras Implementation)", BBSMAX, 14 October 2019 (2019-10-14), pages 1 - 4, XP055936333, Retrieved from the Internet <URL:https://www.bbsmax.com/A/QV5ZgYE4dy/> [retrieved on 20220628] * |
Also Published As
Publication number | Publication date |
---|---|
CN116670688A (en) | 2023-08-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP4036724A1 (en) | Method for splitting neural network model by using multi-core processor, and related product | |
EP4036803A1 (en) | Neural network model processing method and apparatus, computer device, and storage medium | |
WO2021190127A1 (en) | Data processing method and data processing device | |
JP7291183B2 (en) | Methods, apparatus, devices, media, and program products for training models | |
WO2021190597A1 (en) | Processing method for neural network model, and related device | |
CN108701250B (en) | Data fixed-point method and device | |
EP3979143A1 (en) | Method of performing splitting in neural network model by means of multi-core processor, and related product | |
US20220414439A1 (en) | Neuromorphic Synthesizer | |
KR20180134740A (en) | Electronic apparatus and method for optimizing of trained model | |
US10579334B2 (en) | Block floating point computations using shared exponents | |
CN113449859A (en) | Data processing method and device | |
EP4318313A1 (en) | Data processing method, training method for neural network model, and apparatus | |
WO2022111002A1 (en) | Method and apparatus for training neural network, and computer readable storage medium | |
CN112130805B (en) | Chip comprising floating point adder, device and control method of floating point operation | |
US20200184368A1 (en) | Machine learning in heterogeneous processing systems | |
CN113344213A (en) | Knowledge distillation method, knowledge distillation device, electronic equipment and computer readable storage medium | |
WO2022109779A1 (en) | Data processing method and related device | |
WO2023221415A1 (en) | Backbone network generation method and apparatus, device and storage medium | |
WO2023173550A1 (en) | Cross-domain data recommendation method and apparatus, and computer device and medium | |
Zhang et al. | Apply yolov4-tiny on an fpga-based accelerator of convolutional neural network for object detection | |
EP4246375A1 (en) | Model processing method and related device | |
CN115909009A (en) | Image recognition method, image recognition device, storage medium and electronic equipment | |
CN114723024A (en) | Linear programming-based neural network mapping method for storage and calculation integrated chip | |
CN115601513A (en) | Model hyper-parameter selection method and related device | |
WO2021253440A1 (en) | Depth-wise over-parameterization |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 20962670 Country of ref document: EP Kind code of ref document: A1 |
|
WWE | Wipo information: entry into national phase |
Ref document number: 202080107278.2 Country of ref document: CN |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 20962670 Country of ref document: EP Kind code of ref document: A1 |