CN116325703A - Data format processing method and device - Google Patents

Data format processing method and device Download PDF

Info

Publication number
CN116325703A
CN116325703A CN202080105412.5A CN202080105412A CN116325703A CN 116325703 A CN116325703 A CN 116325703A CN 202080105412 A CN202080105412 A CN 202080105412A CN 116325703 A CN116325703 A CN 116325703A
Authority
CN
China
Prior art keywords
format
computing unit
computing
unit
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202080105412.5A
Other languages
Chinese (zh)
Inventor
俞郑中
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Publication of CN116325703A publication Critical patent/CN116325703A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/80Information retrieval; Database structures therefor; File system structures therefor of semi-structured data, e.g. markup language structured data such as SGML, XML or HTML
    • G06F16/84Mapping; Conversion

Abstract

The embodiment of the application discloses a data format processing method and device, relates to the technical field of artificial intelligence, solves the problem of high performance overhead caused by excessive format conversion processing in the prior art, and improves user experience. The specific scheme is as follows: the method is applied to a computing network, and the computing network sequentially comprises a first computing unit and a second computing unit, and comprises the following steps: acquiring data formats supported by a first computing unit and a second computing unit; if the first computing unit is determined not to support the format of the input data of the first computing unit, adding a first format conversion unit before the first computing unit, wherein the first format conversion unit is used for converting the format of the input data of the first computing unit into a data format supported by the first computing unit; if it is determined that the second computing unit supports the format of the output data of the first computing unit, it is determined that the format conversion process is not performed between the first computing unit and the second computing unit.

Description

Data format processing method and device Technical Field
The embodiment of the application relates to the technical field of artificial intelligence, in particular to a data format processing method and device.
Background
In an artificial intelligence (artificial intelligence, AI) chip, in order to fully exploit the computing power of the chip, data is generally required to be arranged according to a specific format, and data in different formats may need to be converted due to different data formats required by different operations.
Fig. 1 is a schematic structural diagram of a computing network, as shown in fig. 1, an operator sequence in the computing network sequentially includes a convolution Conv1 operator, an activation function unit Relu1 operator, a Conv2 operator and a Relu2 operator, wherein the format of input data required by the Conv operator is arranged according to an NC1HWC0 format, and the format of input data required by the Relu operator is arranged according to an ND format. Since the data format of the original picture is NHWC format, which is different from the format of the input data required by Conv1 operator, the format of the input data needs to be converted.
Fig. 2 is a schematic diagram of a data format conversion process, as shown in fig. 2, in which format conversion processing logic may be added to a start position and an end position in a Conv operator, the format conversion processing logic added to the start position in the Conv operator may convert the format of input data from an NHWC format to an NC1HWC0 format, and the format conversion processing logic added to the end position in the Conv operator may convert the format of output data from the NC1HWC0 format to an NHWC format. However, after format conversion processing logic is added in the operator, the time consumption of the operator is increased, and the performance of the operator is reduced. If there are multiple Conv operators in the network, then conversion logic exists inside each Conv operator, so the format conversion process is more, resulting in a large network performance overhead.
Disclosure of Invention
The embodiment of the application provides a data format processing method and device, which can reduce format conversion processing and improve network performance.
In order to achieve the above purpose, the embodiment of the application adopts the following technical scheme:
in a first aspect of the embodiments of the present application, a data format processing method is provided, which is applied to a computing network, where the computing network sequentially includes a first computing unit and a second computing unit, and the method includes: acquiring data formats supported by a first computing unit and a second computing unit; if the first computing unit is determined not to support the format of the input data of the first computing unit, adding a first format conversion unit before the first computing unit, wherein the first format conversion unit is used for converting the format of the input data of the first computing unit into a data format supported by the first computing unit; if it is determined that the second computing unit supports the format of the output data of the first computing unit, it is determined that the format conversion process is not performed between the first computing unit and the second computing unit. Based on the scheme, when the first computing unit does not support the format of the input data of the first computing unit, a first format conversion unit is added before the first computing unit to convert the format of the input data of the first computing unit into the data format supported by the first computing unit, and when the second computing unit supports the format of the output data of the first computing unit, it is determined that the format conversion processing is not performed between the first computing unit and the second computing unit, that is, it is determined that a format conversion operator is not inserted between the first computing unit and the second computing unit, so that the number of format conversion units in a network is reduced, the format processing in the network is reduced, and the network performance is improved.
Alternatively, when the computing network includes three or more computing units, the first computing unit and the second computing unit may be any two computing units that are consecutive in the computing network. For example, when the first computing unit is the first computing unit of the computing network, the second computing unit is the computing unit subsequent to the first computing unit. For another example, when the first computing unit is a computing unit located at an intermediate position of the computing network, the second computing unit is a computing unit subsequent to the first computing unit.
It can be understood that when the format processing is performed, when the second operator does not support the format of the output data of the first operator, a data conversion unit is inserted between the first operator and the second operator, when the third operator supports the format of the output data of the second operator, it is determined that the data conversion unit is not inserted between the second operator and the third operator, when the fourth operator supports the format of the output data of the third operator, it is determined that the data conversion unit is not inserted between the third operator and the fourth operator, until the nth operator does not support the format of the output data of the N-1 operator, that is, when the data format conversion processing is performed or not is judged, the continuity of the data formats supported by the plurality of operators is considered, and compared with the prior art, the format conversion processing can be greatly reduced, and the network performance is improved.
With reference to the first aspect, in a possible implementation manner, in a case that the first computing unit is a first computing unit in the computing network, a format of input data of the first computing unit is a format of original input data of the computing network. Based on the scheme, under the condition that the first computing unit does not support the format of the original input data, the format conversion processing unit is inserted before the first computing unit so as to convert the format of the original input data into the data format supported by the first computing unit, so that the operation of the first computing unit can be normally performed.
With reference to the first aspect and the foregoing possible implementation manners, in another possible implementation manner, in a case where the first computing unit is a computing unit located at an intermediate position in the computing network, a format of input data of the first computing unit is a format of output data of a computing unit before the first computing unit. According to the scheme, when the first computing unit located in the middle does not support the format of the output data of the previous computing unit, the format conversion processing unit is inserted between the previous computing unit of the first computing unit and the first computing unit to convert the format of the output data of the previous computing unit of the first computing unit into the data format supported by the first computing unit, so that the operation of the first computing unit can be normally performed.
With reference to the first aspect and the foregoing possible implementation manners, in another possible implementation manner, in a case where the second computing unit supports a plurality of data formats, determining a format in which the second computing unit supports output data of the first computing unit includes: if the plurality of data formats supported by the second computing unit include the format of the output data of the first computing unit, determining the format of the output data of the first computing unit supported by the second computing unit. Based on the scheme, in the case that the plurality of data formats supported by the second computing unit include the format of the output data of the first computing unit, the format of the output data of the first computing unit supported by the second computing unit can be determined, so that the format conversion processing is not performed between the first computing unit and the second computing unit, thereby reducing the times of the format conversion processing in the network and improving the network performance. Alternatively, in the case where one data format supported by the second computing unit is the same as the format of the output data of the first computing unit, it may be determined that the second computing unit supports the format of the output data of the first computing unit.
With reference to the first aspect and the foregoing possible implementation manners, in another possible implementation manner, the acquiring a data format supported by the first computing unit and the second computing unit includes: acquiring preset mode types of the first computing unit and the second computing unit; the preset mode types include a format independent class, a reduced reduction class and a Broadcast class; and determining the data formats supported by the first computing unit and the second computing unit according to the preset mode types of the first computing unit and the second computing unit. Based on the scheme, the mode type can be divided for each operator in the operator information base, so that the data format supported by the operator can be determined according to the mode type information of the operator, the information quantity in the operator information base can be reduced, and each format supported by the operator does not need to be configured. And the operator information base is used for configuring the preset mode type of the operator, so that the operator can directly operate according to the input shape and the attribute of the operator without paying attention to a specific format, and the format processing burden in the operator development is reduced.
With reference to the first aspect and the foregoing possible implementation manners, in another possible implementation manner, the foregoing method further includes: if it is determined that the format of the output data of the last computing unit of the computing network is different from the format of the original output data of the computing network, a second format conversion unit is added after the last computing unit of the computing network, where the second format conversion unit is configured to convert the format of the output data of the last computing unit into the format of the original output data of the computing network. According to the scheme, when the format of the output data of the last computing unit of the computing network is different from that of the original output data, the format of the output data of the computing network is kept consistent with that of the original output data through format conversion processing. Optionally, when the second computing unit is the last computing unit of the computing network, if the format of the output data of the second computing unit is different from the format of the original output data, a format conversion operator is inserted after the second computing unit to convert the format of the output data of the second computing unit into the format of the original output data.
In a second aspect of the embodiments of the present application, a data format processing apparatus is provided, which is applied to a computing network, where the computing network sequentially includes a first computing unit and a second computing unit, and the apparatus includes: a processing unit and an acquisition unit; the acquisition unit is used for acquiring the data formats supported by the first calculation unit and the second calculation unit; the processing unit is used for adding a first format conversion unit before the first calculation unit if the first calculation unit is determined not to support the format of the input data of the first calculation unit, wherein the first format conversion unit is used for converting the format of the input data of the first calculation unit into the data format supported by the first calculation unit; and the processing unit is also used for determining that the format conversion processing is not performed between the first computing unit and the second computing unit if the second computing unit is determined to support the format of the output data of the first computing unit.
With reference to the second aspect, in a possible implementation manner, in a case that the first computing unit is a first computing unit in the computing network, a format of input data of the first computing unit is a format of original input data of the computing network.
With reference to the second aspect and the foregoing possible implementation manner, in another possible implementation manner, in a case where the first computing unit is a computing unit located at an intermediate position in the computing network, a format of input data of the first computing unit is a format of output data of a computing unit before the first computing unit.
With reference to the second aspect and the foregoing possible implementation manner, in another possible implementation manner, the processing unit is specifically configured to determine a format in which the second computing unit supports output data of the first computing unit if it is determined that the plurality of data formats supported by the second computing unit includes a format in which the output data of the first computing unit is output.
With reference to the second aspect and the foregoing possible implementation manners, in another possible implementation manner, the acquiring unit is further configured to acquire a preset pattern type of the first computing unit and the second computing unit; the preset mode types include a format independent class, a reduced reduction class and a Broadcast class; the processing unit is further configured to determine a data format supported by the first computing unit and the second computing unit according to a preset mode type of the first computing unit and the second computing unit.
With reference to the second aspect and the foregoing possible implementation manners, in another possible implementation manner, the foregoing processing unit is further configured to: if it is determined that the format of the output data of the last computing unit of the computing network is different from the format of the original output data of the computing network, a second format conversion unit is added after the last computing unit of the computing network, where the second format conversion unit is configured to convert the format of the output data of the last computing unit into the format of the original output data of the computing network.
In a third aspect of the embodiments of the present application, an electronic device is provided, where the electronic device may implement the data format processing method described in the first aspect, and the method may be implemented by software, hardware, or by executing corresponding software by hardware. In one possible implementation, the electronic device may include a processor and a memory. The processor is configured to support the electronic device to perform the corresponding functions of the method according to the first aspect. The memory is used to couple with the processor, which holds the program instructions and data necessary for the electronic device.
In a fourth aspect of embodiments of the present application, a computer readable storage medium is provided, the computer readable storage medium comprising computer instructions which, when run on an electronic device, cause the electronic device to perform the data format processing method as described in the first aspect and possible implementations thereof.
In a fifth aspect of embodiments of the present application, a computer program product is provided, which when run on a computer causes the computer to perform the data format processing method according to the first aspect and possible implementation manners thereof.
In a sixth aspect of the embodiments of the present application, there is provided an electronic device, including a central processing unit (Central Process Unit, CPU) and a Neural network processor (Neural-network Processing Unit, NPU), where the CPU is configured to execute the data format processing method according to the first aspect and possible implementations thereof, and the NPU is configured to execute a computing network obtained by the CPU based on the data format processing method.
The description of the effects of the second aspect, the third aspect, the fourth aspect, the fifth aspect and the sixth aspect may refer to the description of the corresponding effects of the first aspect, and are not repeated herein.
Drawings
Fig. 1 is a schematic structural diagram of a computing network according to an embodiment of the present application;
fig. 2 is a schematic diagram of a data format conversion process according to an embodiment of the present application;
fig. 3 is a schematic diagram of data composition of a picture according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a data format according to an embodiment of the present application;
FIG. 5 is a schematic diagram of another data format conversion process according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of a system architecture according to an embodiment of the present application;
fig. 7 is a flow chart of a data format processing method according to an embodiment of the present application;
fig. 8 is an application schematic diagram of a data format processing method provided in an embodiment of the present application;
fig. 9 is an application schematic diagram of another data format processing method according to an embodiment of the present application;
FIG. 10 is a schematic diagram illustrating an intermediate logic process of a data format processing method according to an embodiment of the present disclosure;
fig. 11 is a schematic diagram of a data format processing device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application. In this application, "at least one" means one or more, and "a plurality" means two or more. "and/or", describes an association relationship of an association object, and indicates that there may be three relationships, for example, a and/or B, and may indicate: a alone, a and B together, and B alone, wherein a, B may be singular or plural. The character "/" generally indicates that the context-dependent object is an "or" relationship. "at least one of" or the like means any combination of these items, including any combination of single item(s) or plural items(s). For example, at least one (one) of a, b or c may represent: a, b, c, a and b, a and c, b and c, or a and b and c, wherein a, b and c may be single or plural. In addition, in order to clearly describe the technical solutions of the embodiments of the present application, in the embodiments of the present application, the terms "first", "second", and the like are used to distinguish the same item or similar items having substantially the same function and effect, and those skilled in the art will understand that the terms "first", "second", and the like do not limit the number and execution order. For example, "first" in the first computing unit and "second" in the second computing unit in the embodiments of the present application are only used to distinguish between different computing units. The first, second, etc. descriptions in the embodiments of the present application are only used for illustrating and distinguishing the description objects, and no order division is used, nor does it indicate that the number of the devices in the embodiments of the present application is particularly limited, and no limitation on the embodiments of the present application should be construed.
In this application, the terms "exemplary" or "such as" are used to mean serving as an example, instance, or illustration. Any embodiment or design described herein as "exemplary" or "for example" should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "such as" is intended to present related concepts in a concrete fashion.
First, the meaning of various data formats related to the present application will be explained.
1、NCHW
Where N represents the number batch, C represents the channel, H represents the height, and W represents the width. The arrangement sequence of the NCHW format is [ batch, channels, height, width ], namely the arrangement sequence of the data is sequentially arranged according to W dimension, H dimension, C dimension and N dimension. For example, taking an input picture as one, the data of the picture is the data shown in fig. 3 as an example, if the NCHW format is used for storage, shape is (1, 3, 10, 10). The data arrangement in the format of NCHW is shown in fig. 4 (a), wherein the first element is 000 and the second element is 001 along W direction, i.e., in the order from W direction to 009, and then along H direction, i.e., 010, 011, 012..019 … 090 … to 099, and then along C direction, 100, 101..109, 110, 111..119 …, 200, 201 … to 299. If N is an integer greater than 1, then the sequential arrangement continues along the N direction.
2、NHWC
The arrangement sequence of NHWC is [ batch, height, width, channels ], namely the arrangement sequence of the data is sequentially arranged according to the C dimension, the W dimension, the H dimension and the N dimension. For example, taking an input picture as one, the data of the picture is the data shown in fig. 3 as an example, if the NHWC format is used for storage, shape is (1, 10, 3). Fig. 4 (b) shows a data arrangement in NHWC format, in which the first element is 000 and the second element is 100 along the C direction, so that it goes from C to 200 in turn along the W direction, i.e. 001, 101, 201 … 009 … to 209, and then goes from H direction, 010, 110, 210, 011, 111, 211 … to 299, as shown in fig. 4 (b). If N is an integer greater than 1, then the sequential arrangement continues along the N direction.
3、NC1HWC0
The NC1HWC0 format is a C-axis split, which can be split into C1C 0. Under the condition that N is 1, the data are sequentially arranged according to the C dimension, the W dimension, the H dimension of the first C0, the C dimension, the W dimension and the H dimension … of the second C0 to the C dimension, the W dimension and the H dimension of the C1 th C0. If N is an integer greater than 1, then the sequential arrangement continues along the N direction.
Optionally, when using the NC1HWC0 format, if the number of C axes is not a multiple of C0, the C axis dimension needs to be first extended to a multiple of C0 with a 0 value, and then split into two dimensions of C1 and C0, and converted into the NC1HWC0 format. If the number of C-axes is a multiple of C0, then the C-axes can be split into two dimensions, C1 and C0, without expansion.
For example, taking an input picture as one, the data of the picture is the data shown in fig. 3 as an example, if NC1HWC0 format is used for storage, shape is (1, 10, 10, 16), where C0 is 16. Since the C-axis of the picture is 3, the C-dimension needs to be first extended to a multiple of 16 using a value of 0. And splitting the C dimension into two dimensions of C1 and C0, and finally transposing the two dimensions into an NC1HWC0 format. In fig. 4, (C) is a data arrangement in NC1HWC0 format, as shown in fig. 4, (C), the first element is 000, the second element is 100 along the C direction of the first C0, so that it goes to 200,0,0,0,0..0 along the C direction, and then goes to 0, 009, 109, 209,0..0 along the W direction, i.e. 001, 101, 201,0..0, 009, 109, 209,0..0, and then goes to 0 along the H direction, 010, 110, 210,0..0, 011, 111, 211 … until the last 0. If N is an integer greater than 1, then the sequential arrangement continues along the N direction.
Note that, in the NC1HWC0 format, the value of C0 is related to hardware, the chips are different, and the value of C0 may be different, which is not limited in the embodiment of the present application, and in the embodiment of the present application and the drawings, only C0 is taken as 16 for example.
Alternatively, the NHWC format may be converted to NC1HWC0 format by a format conversion process, i.e., splitting the initial C-axis into C1 and C0 axes, and then adjusting the axis order. For example, the initial Shape is (32, 114, 114, 32), and after the format is adjusted to NC1HWC0, the Shape is adjusted to (32, 2, 114, 114, 16).
Alternatively, the NCHW format may be converted to the NC1HWC0 format by a format conversion process, i.e., splitting the initial C-axis into C1 and C0 axes, and then adjusting the axis order. For example, the initial Shape is (32, 32, 114, 114), and after the adjustment to NC1HWC0, the Shape is adjusted to (32, 2, 114, 114, 16).
In AI chips, it is often required that data be arranged in a specific format, and because of the different data formats required for different operations, it may be necessary to convert the data in different formats.
For example, as shown in fig. 1, the operator sequence in the computing network sequentially includes a Conv1 operator, a renu 1 operator, a Conv2 operator, and a renu 2 operator, where the Conv operator requires that the format of the input data be arranged according to NC1HWC0 format, and the renu operator requires that the format of the input data be arranged according to ND format. Since the data format of the original picture is NHWC format, which is different from the format of the input data required by Conv1 operator, the format of the input data needs to be converted. Note that ND means that the operation is performed in the original format. Alternatively, the raw format may be NHWC or NCHW. I.e. the ND format may be NHWC format or NCHW format.
For example, as shown in a schematic diagram of a data format conversion process in fig. 2, by adding format conversion processing logic to a start position and an end position in a Conv operator, respectively, the format conversion processing logic with the start position added in the Conv operator can convert the format of input data from the NHWC format to the NC1HWC0 format, and the format conversion processing logic with the end position added in the Conv operator can convert the format of output data from the NC1HWC0 format to the NHWC format. However, after format conversion processing logic is added in the operator, the time consumption of the operator is increased, and the performance of the operator is reduced. If there are multiple Conv operators in the network, conversion logic exists inside each Conv operator, and network performance overhead is large.
As another example, as shown in another schematic diagram of the data format conversion process in fig. 5, by inserting a format conversion operator (e.g., transData) before and after each Conv operator, the format conversion operator inserted before the Conv operator may convert the format of the original input data from the NHWC format to the NC1HWC0 format, and the format conversion operator inserted after the Conv operator may convert the format of the output data of the Conv operator from the NC1HWC0 format to the NHWC format. However, the format conversion operators inserted by the method bring additional performance cost, and if the format conversion operators are in a large network with 20 layers of the small network structure, the number of the format conversion operators can be doubled by 20, the performance cost is high, and the network performance is reduced.
It can be understood that the difference between the data format conversion processing method shown in fig. 2 and the data format conversion processing method shown in fig. 5 is that the method shown in fig. 2 performs format conversion inside an operator, and the method shown in fig. 5 performs format conversion outside the operator, and both the data format conversion processing methods have the problem of high network performance overhead when performing format conversion processing.
In order to alleviate the problem of high network performance overhead caused by excessive format conversion processing, the embodiment of the application provides a data format processing method, which can reduce format conversion processing and improve network performance.
The data format processing method provided in the embodiment of the present application may be applied to the system architecture shown in fig. 6. As shown in fig. 6, the system architecture includes a Graph Engine (GE), a Fusion Engine (FE), and an Operator library (Op).
Wherein GE and FE call operators in Op. The Op is provided with an operator prototype library, an operator information library and an operator realization library. The operator prototype library provides definitions of operators, such as which inputs, outputs, and properties the operators have. The operator information base provides operator implementation capabilities such as the data types supported by the operators and the supported input data formats (formats) and output data formats, etc. The operator realization library provides the realization of operators, and the FE carries out operator compiling to generate operators by calling the operator realization library.
The FE is used to handle hardware dependent graph optimization. The FE includes an Op judgment module (Op Judge), a Format selection module (Format Selector), and an operator information base loading module (Op Store). The Op judging module in the FE is responsible for adjusting the operator, so that the operator adapts to hardware and can well run on a corresponding chip. For example, when the initial data format and the data format supported by the operator are different, the Op determination module in the FE may perform a format conversion process on the initial data format, so that the converted data format is the data format supported by the operator. The operator information base loading module loads the operator information base during initialization to obtain the capability of each operator and the supported data format. A Format Selector module (Format Selector) is responsible for selecting which of a plurality of data formats to use when a certain operator supports the plurality of data formats. For example, the format selection module may select a data format of the plurality of data formats that is the same as a format of output data of an operator that is prior to the operator when the operator supports the plurality of data formats, to maintain continuity of the data formats.
And loading an operator prototype library during the initialization of the GE, and loading an operator information library during the initialization of the FE. The GE invokes the deriving logic in the prototype library of the operator to derive the initial shape and the initial data format of each operator node in the network graph, and the GE invokes the FE to perform hardware-related optimization on the network graph (graph).
Illustratively, the operator information library described above may provide operator-supported data formats in two ways. The first way is to classify operators, and the data formats supported by different preset mode types can be different through the preset mode type to which the operator belongs is configured by the op.pattern. The second is the input data format supported by the input0.format configuration operator.
Alternatively, the preset pattern types of the operators may include: format independent classes, reduced classes, and Broadcast classes.
The format independent class can support any data format, and is applicable to a pure ElementWise operator for adjusting single input and single output, for example, the operators of the format independent class can comprise an Sqrt operator, a Square operator, a Sin operator, a Neg operator and other operators. Operators of format independent classes support adjustment between arbitrary formats. For example, formats supported by the format independent class operator include NCHW, NHWC, NC HWC0, FRACTAL_ Z, FRACTAL _Z_ D, FRACTAL _NZ, C1HWNCoC0, and the like. The embodiments of the present application are not limited to the type of data format supported by the format independent class operator, but are merely illustrative herein.
The data format supported by the Reduce class operator is related to constraints. The Reduce class operator may include an operator such as ReduceSum, reduceMax, reduceMin. For example, for a Reduce class operator, a scenario containing a C-axis in the Reduce axis supports the input data format NC1HWC0, and the output data format ND. In a scenario where the Reduce axis does not include the C axis, the input data format NC1HWC0 is supported, and the output data format NC1HWC0 is supported. The Reduce class operator supports the input data format as ND, and the output data format as ND, whatever the scenario.
For example, the initial Shape entered is (32, 32, 114, 114), the initial format is NCHW, the initial Reduce axis attribute is [1, ], the format entered is NC1HWC0 after the format adjustment, the Shape adjusted is (32, 2, 114, 114, 16), and the reduced axis attribute is [1,4].
The data format supported by the Broadcast class operator is related to constraints. Broadcast class operators include Add, realDiv, minimum, etc. operators. For example, for a Broadcast class operator, in a scenario where the Broadcast axis does not contain C, the input data format is NC1HWC0 and the output data format is NC1HWC0. If the axis of the Broadcat contains a scene of the C axis, the input data format supported by the Broadcast operator is ND, and the output data format is ND.
Optionally, when the operator information base configures the preset mode type to which the operator belongs through the op.pattern, a specific configuration mode is as follows:
[Square]
input0.name=x
input0.dtype=float16,float,int32
output0.name=y
output0.dtype=float16,float,int32
op.pattern=formatAgnostic
optionally, when the operator information base configures the data format supported by the operator through input0.format, a specific configuration mode is as follows:
[Square]
input0.name=x
input0.dtype=float16,float,int32
input0.format=ND,NC1HWC0
output0.name=y
output0.dtype=float16,float,int32
output0.format=ND,NC1HWC0
alternatively, when the operator does not belong to any mode type preset, the data format supported by the operator can be configured through input0.format. However, when the operator supports a plurality of data formats, a configuration by input0.format is required for each data format supported by the operator.
It can be understood that the operator information base classifies the operators, adopts the op.pattern to configure the preset mode type of the operators, and can determine the data format supported by the operators according to the preset mode type. And the operator information base is used for configuring the preset mode type of the operator, so that the operator can directly operate according to the input shape and the attribute of the operator without paying attention to a specific format, and the format processing burden in the operator development is reduced.
The embodiment of the application provides a data format processing method, which is applied to a computing network, wherein the computing network sequentially comprises a first computing unit and a second computing unit, as shown in fig. 7, and the data format processing method can comprise the following steps:
s701, acquiring data formats supported by the first computing unit and the second computing unit.
It may be appreciated that in the step S701, the processor may call the interface of the operator information base loading module to acquire the data formats supported by the first computing unit and the second computing unit.
Optionally, the first computing unit and the second computing unit in the embodiment of the present application may be the same type of operators, or may be different types of operators, and the embodiment of the present application is not limited to specific operator types of the first computing unit and the second computing unit.
The data format processing method provided by the embodiment of the application can be applied to a computing network shown in fig. 1, where an operator sequence in the computing network sequentially includes a Conv1 operator, a Relu1 operator, a Conv2 operator, and a Relu2 operator. The specific structure of the operator sequence in the computing network is not limited in the embodiment of the present application, and only the operator sequence is illustrated as an example of the operator sequence shown in fig. 1.
Alternatively, the first computing unit may be a first computing unit in the computing network, or may be a computing unit located in an intermediate position in the computing network. For example, when the first computing unit is the first computing unit in the computing network, the first computing unit may be the Conv1 operator in fig. 1, and the second computing unit may be the Relu1 operator in fig. 1, where the input data of the Conv1 operator is the original input data of the computing network. For another example, when the first computing unit is a computing unit located at an intermediate position in the computing network, the first computing unit may be a Conv2 operator in fig. 1, and the second computing unit may be a Relu2 operator in fig. 1, where input data of the Conv2 operator is output data of the Relu1 operator. It can be appreciated that the embodiment of the present application is not limited to a specific location of the first computing unit in the computing network, where the first computing unit is a computing unit before the second computing unit.
For example, the acquiring the data formats supported by the first computing unit and the second computing unit in the step S701 may include: acquiring preset mode types of a first computing unit and a second computing unit; and determining the data formats supported by the first computing unit and the second computing unit according to the preset mode types of the first computing unit and the second computing unit. The preset pattern types may include a format independent class, a reduced reduction class, and a Broadcast class. Alternatively, the FE may obtain the preset pattern types of the first computing unit and the second computing unit from the operator information base. Optionally, when the FE obtains the data formats supported by the first computing unit and the second computing unit, the data formats supported by the first computing unit and the second computing unit may be determined according to the preset mode type and specific constraint conditions.
It can be understood that the operator can be realized without paying attention to a specific format by configuring the preset mode type of the operator through the operator information base, and the operator can directly operate according to the input shape and the attribute of the operator, so that the format processing burden in the operator development is reduced.
Optionally, when the first computing unit in the operator information base configures the data format supported by the operator through input0.format, the FE may directly obtain the data format supported by the first computing unit from the operator information base.
Alternatively, the data format supported by the computing unit in the embodiments of the present application may be the format of the input data supported by the computing unit.
S702, if the first computing unit is determined not to support the format of the input data of the first computing unit, adding a first format conversion unit before the first computing unit.
It is understood that the step S702 may be performed by the processor to determine whether the first computing unit supports the format of the input data of the first computing unit, and add the first format conversion unit before the first computing unit when the processor determines that the first computing unit does not support the format of the input data of the first computing unit. Optionally, if the processor determines that the first computing unit supports the format of the input data of the first computing unit, the processor determines that no format conversion process is performed before the first computing unit.
The first format conversion unit is used for converting the format of the input data of the first computing unit into a data format supported by the first computing unit.
In an exemplary case where the first computing unit supports one data format, the processor determines that the first computing unit does not support the format of the input data of the first computing unit if the data format supported by the first computing unit is different from the format of the input data of the first computing unit.
In an exemplary case where the first computing unit supports a plurality of data formats, the processor determines that the first computing unit does not support the format of the input data of the first computing unit if the plurality of data formats supported by the first computing unit does not include the format of the input data of the first computing unit.
In the case where the first computing unit does not support the format of the input data of the first computing unit, by adding the first format converting unit before the first computing unit, the format of the input data of the first computing unit can be converted into the data format supported by the first computing unit.
In one implementation, if the first computing unit is the first computing unit in the computing network, the input data of the first computing unit is the original input data of the computing network. I.e. the format of the input data of the first computing unit is the format of the original input data of the computing network.
Alternatively, the original input data of the computing network may be the initial input data of the network. For example, the original input data of the computing network may be real picture data, voice data, text data, or the like.
In an exemplary embodiment, when the first computing unit supports a data format and the data format supported by the first computing unit is different from the format of the original input data of the computing network, the processor determines that the first computing unit does not support the format of the original input data of the computing network. When the first computing unit supports a plurality of data formats and the plurality of data formats supported by the first computing unit does not include a format of the original input data of the computing network, the processor determines that the first computing unit does not support the format of the original input data of the computing network.
If the processor determines that the first computing unit does not support the format of the original input data of the computing network, the processor adds a first format conversion unit before the first computing unit to convert the format of the original input data of the computing network into a data format supported by the first computing unit.
For example, as shown in fig. 8, taking the first calculation unit as Conv1 operator, the second calculation unit as Relu1 operator, and the format of the original input data of the calculation network as NHWC as an example, since the data format supported by the Conv operator is NC1HWC0, that is, the data format supported by the Conv1 operator is different from the format NHWC of the original input data (the format of the original input data is not supported by the Conv1 operator), a format conversion operator for converting the format NHWC of the original input data into the data format NC1HWC0 supported by the Conv1 operator is inserted before the Conv1 operator.
In another implementation manner, if the first computing unit is a computing unit located at an intermediate position in the computing network, the input data of the first computing unit is output data of a computing unit before the first computing unit. I.e. the format of the input data of the first calculation unit is the format of the output data of the calculation unit preceding the first calculation unit.
For example, taking an example that the operator sequence in the computing network sequentially includes a third computing unit, a first computing unit, and a second computing unit, that is, a computing unit before the first computing unit is the third computing unit. When the first computing unit supports one data format and the data format supported by the first computing unit is different from the format of the output data of the third computing unit, the processor determines that the first computing unit does not support the format of the output data of the third computing unit. When the first computing unit supports a plurality of data formats and the plurality of data formats supported by the first computing unit does not include the format of the output data of the third computing unit, the processor determines that the first computing unit does not support the format of the output data of the third computing unit.
If the processor determines that the first computing unit does not support the format of the output data of the third computing unit, the processor adds a first format conversion unit between the third computing unit and the first computing unit to convert the format of the output data of the third computing unit into a data format supported by the first computing unit.
S703, if it is determined that the second computing unit supports the format of the output data of the first computing unit, it is determined that the format conversion process is not performed between the first computing unit and the second computing unit.
It is to be understood that the above step S703 may be determined by the processor whether the second computing unit supports the format of the output data of the first computing unit, and when the processor determines that the second computing unit supports the format of the output data of the first computing unit, the processor determines that the format conversion process is not performed between the first computing unit and the second computing unit. Optionally, if the processor determines that the second computing unit does not support the format of the output data of the first computing unit, the processor adds a format conversion processing unit between the first computing unit and the second computing unit to convert the format of the output data of the first computing unit into the data format supported by the second computing unit.
In an exemplary case where the second computing unit supports one data format, the processor determines that the second computing unit supports the format of the output data of the first computing unit if the data format supported by the second computing unit is the same as the format of the output data of the first computing unit.
In an exemplary case where the second computing unit supports a plurality of data formats, the processor determines that the second computing unit supports the format of the output data of the first computing unit if the plurality of data formats supported by the second computing unit includes the format of the output data of the first computing unit.
In the case where the second computing unit supports the format of the output data of the first computing unit, the processor determines that the format conversion process is not performed between the first computing unit and the second computing unit. It can be understood that, in the case that the second computing unit supports the format of the output data of the first computing unit, the second computing unit may directly use the output data of the first computing unit as the input data of the second computing unit and process the input data of the second computing unit, and no format conversion process is required to be performed on the output data of the first computing unit, so that format processing in the computing network can be reduced, and network performance is improved. That is, when considering whether to perform data format conversion processing, the embodiment of the application considers continuity of data formats supported between multiple operators, so that when the latter operator supports the format of output data of the former operator, it is determined that format conversion processing is not performed between the two operators, thereby reducing the number of format processing in the computing network and improving network performance.
For example, as shown in fig. 8, taking the first computing unit as a Conv1 operator and the second computing unit as a Relu1 operator as an example, if the schema type configured by the Relu operator in the operator information base is a format independent class (for example, op.pattern=format agnostic), the processor determines that the Relu1 operator supports an arbitrary data format, that is, the Relu1 operator supports a format of output data of the Conv1 operator, then the processor determines that format conversion processing is not performed between the Conv1 operator and the Relu1 operator, that is, the format conversion operator is not inserted between the Conv1 operator and the Relu1 operator.
For another example, as shown in fig. 8, taking the first calculation unit as a Relu1 operator and the second calculation unit as a Conv2 operator as an example, since the format of data supported by the Conv operator is NC1HWC0 and the format of output data of the Relu1 operator is NC1HWC0, the processor determines that the format of output data of the Relu1 operator is supported by the Conv2 operator, and then the processor determines that the format conversion process is not performed between the Relu1 operator and the Conv2 operator, that is, the format conversion operator is not inserted between the Relu1 operator and the Conv2 operator.
For another example, as shown in fig. 8, taking the first computing unit as a Conv2 operator and the second computing unit as a Relu2 operator as an example, if the schema type configured by the Relu operator in the operator information base is a format independent class (for example, op.pattern=format agnostic), the processor determines that the Relu2 operator supports an arbitrary data format, that is, the Relu2 operator supports a format of output data of the Conv2 operator, then the processor determines that format conversion processing is not performed between the Conv2 operator and the Relu2 operator, that is, the format conversion operator is not inserted between the Conv2 operator and the Relu2 operator.
According to the scheme of the embodiment of the application, for two continuous operators, if the latter operator supports the format of the output data of the former operator, the processor determines that the format conversion processing is not performed between the two operators, and if the latter operator does not support the format of the output data of the former operator, the processor determines that the format conversion processing is performed between the two operators (i.e. inserts the format conversion operator between the two operators), so as to convert the format of the output data of the former operator into the data format supported by the latter operator.
It can be appreciated that, in the data format processing method provided in the embodiment of the present application, when the first computing unit does not support the format of the input data of the first computing unit, the first format conversion unit is added before the first computing unit, and when the second computing unit supports the format of the output data of the first computing unit, the format conversion process is not performed between the first computing unit and the second computing unit, so that the number of format conversion units in the network is reduced, the format processing in the network is reduced, and the network performance is improved.
It should be noted that, when the format processing is performed, in this embodiment of the present application, when the second operator does not support the format of the output data of the first operator, a data conversion unit is inserted between the first operator and the second operator, when the third operator supports the format of the output data of the second operator, a data conversion unit is not inserted between the second operator and the third operator, when the fourth operator supports the format of the output data of the third operator, a data conversion unit is not inserted between the third operator and the fourth operator, until the nth operator does not support the format of the output data of the N-1 operator, a data conversion unit is inserted between the N-1 operator and the nth operator, so that, compared with the prior art, the continuity of the data formats supported by the plurality of operators is considered in this application, the format conversion processing can be greatly reduced, and the network performance is improved.
(optional) S704, if it is determined that the format of the output data of the last computing unit of the computing network is different from the format of the original output data of the computing network, adding a second format conversion unit after the last computing unit of the computing network.
It is to be understood that, in step S704, the processor determines whether the format of the output data of the last computing unit of the computing network is the same as the format of the original output data, and adds a second format conversion unit after the last computing unit of the computing network when the processor determines that the format of the output data of the last computing unit of the computing network is different from the format of the original output data.
Optionally, the original output data of the computing network is original output data after being processed by the network. The original output data of the computing network is in a data format that is not adapted to the hardware. For example, the Conv operator needs to convert the format of the input data into NC1HWC0 format, where NC1HWC0 format is the data format of the adapting hardware, and the raw output data of the computing network is the data format of the unadapted hardware, for example, the raw output data of the computing network may be in NCHW format or NHWC format.
Optionally, the format of the original output data of the computing network may be the same as the format of the original input data of the computing network, or may be different from the format of the original input data of the computing network, which is not limited in this application.
The second format conversion unit is configured to convert a format of output data of the last calculation unit into a format of original output data of the calculation network.
For example, in the case that the format of the output data of the last operator of the computing network is different from the format of the original output data of the computing network, in order to ensure that the format of the output data of the computing network is consistent with the format of the original output data, a format conversion operator may be inserted after the last computing unit to convert the format of the output data of the last operator into the format of the original output data.
As shown in fig. 9, taking the format of the original output data of the computing network as NHWC and the Relu2 operator as the last operator of the computing network as an example, since the format of the output data of the Relu2 operator is NC1HWC0, which is different from the format of the original output data, a format conversion operator (second format conversion unit) is added after the Relu2 operator, so as to convert the format of the output data of the Relu2 operator into NHWC format, so as to ensure that the format of the output data of the computing network is the same as the format of the original output data.
It can be appreciated that, in the data format processing method provided in the embodiment of the present application, when the first computing unit does not support the format of the input data of the first computing unit, the first format conversion unit is added before the first computing unit, and when the second computing unit supports the format of the output data of the first computing unit, the format conversion process is not performed between the first computing unit and the second computing unit, so that the number of format conversion units in the network is reduced, the format processing in the network is reduced, and the network performance is improved. And when the format of the output data of the last computing unit of the computing network is different from the format of the original output data, the processor performs conversion processing on the format of the output data of the last computing unit so as to keep the format of the output data of the computing network consistent with the format of the original output data.
The following explains the intermediate logic of the above scheme according to the embodiment of the present application.
Illustratively, taking the computing network shown in FIG. 1 as an example, the operator sequence in the computing network includes, in order, a Conv1 operator, a Relu1 operator, a Conv2 operator, and a Relu2 operator.
As shown in fig. 1, for the Conv1 operator, since the format of the original input data is NHWC and the data format supported by the Conv1 operator is NC1HWC0, the Conv1 operator does not support the format of the original input data, and thus the format conversion operator is inserted before the Conv1 operator and after the Conv1 operator, respectively. As shown in (a) of fig. 10, a format conversion operator before the Conv1 operator is used to convert the format NHWC of the original input data into a data format NC1HWC0 supported by the Conv1 operator, and a format conversion operator after the Conv1 operator is used to convert the format NC1HWC0 of the output data of the Conv1 operator into NHWC.
As shown in fig. 10 (a), for the Relu1 operator, the mode configured in the operator information base is a format independent type, that is, the Relu1 operator supports any data format, and the same data format as the previous operator (that is, conv1 operator) can be selected for processing, so that the format conversion operator is inserted before the Relu1 operator and after the Relu1 operator, respectively. As shown in (b) of fig. 10, a format conversion operator before the Relu1 operator is used to convert the format NHWC of the original input data into NC1HWC0, and a format conversion operator after the Relu1 operator is used to convert the format NC1HWC0 of the output data of the Relu1 operator into NHWC.
As shown in fig. 10 (b), since the format conversion operator after the Conv1 operator and the format conversion operator before the Relu1 operator are logically reciprocal, the elimination can be performed, and the calculation network shown in fig. 10 (c) is obtained after the elimination. It can be appreciated that by exposing the hardware format to the FE layer, the present application finds the opportunity for format conversion cancellation at the FE layer, reducing the format conversion process, resulting in improved network performance.
As shown in (c) of fig. 10, for the Conv2 operator, since the format of input data of the Conv2 operator is NHWC and the data format supported by the Conv2 operator is NC1HWC0, the format of input data of the Conv2 operator is not supported by the Conv2 operator, and thus the format conversion operator is inserted before the Conv2 operator and after the Conv2 operator, respectively. As shown in (d) of fig. 10, the format conversion operator before the Conv2 operator is used to convert the format NHWC of the original input data into the data format NC1HWC0 supported by the Conv2 operator, and the format conversion operator after the Conv2 operator is used to convert the format NC1HWC0 of the output data of the Conv2 operator into NHWC. It can be understood that, in fig. 10 (c), the input data of the Conv2 operator is the data of the output of the Relu1 operator after being converted by the format conversion operator, so that the format of the input data of the Conv2 operator is the data of the output of the Relu1 operator after being converted by the format conversion operator.
As shown in (d) of fig. 10, since the format conversion operator after the Relu1 operator and the format conversion operator before the Conv2 operator are logically reciprocal, the elimination can be performed, and the calculation network shown in (e) of fig. 10 is obtained after the elimination.
As shown in (e) of fig. 10, for the reu 2 operator, since the pattern of the reu operator in the operator information base configuration is a format independent class, that is, the reu 2 operator supports an arbitrary data format, the same data format as the previous operator (that is, conv2 operator) can be selected for processing, so that the format conversion operator is inserted before the reu 2 operator and after the reu 2 operator, respectively. As shown in (f) of fig. 10, a format conversion operator before the Relu2 operator is used to convert the format NHWC of the original input data into NC1HWC0, and a format conversion operator after the Relu2 operator is used to convert the format NC1HWC0 of the output data of the Relu2 operator into NHWC.
As shown in fig. 10 (f), since the format conversion operator after the Conv2 operator and the format conversion operator before the Relu2 operator are logically reciprocal, the elimination can be performed, and the calculation network shown in fig. 10 (g) is obtained after the elimination.
It can be understood that the computing network shown in (f) in fig. 10 is the computing network shown in fig. 9 obtained by adopting the scheme of the embodiment of the present application. In contrast to the computing network shown in fig. 2, the computing network does not perform format conversion inside the operators, but rather at the FE layer, so that conversion logic inside each Conv operator is not required as in the scheme shown in fig. 2. Compared with the computing network shown in fig. 5, the scheme of the embodiment of the application does not need to insert a format conversion operator before and after each Conv operator, and only if the latter operator does not support the format of the output data of the former operator, the format conversion operator is inserted to perform format conversion processing, so that the number of format conversion processing in the network is reduced and the network performance is improved.
It should be noted that, in the application, the hardware format is exposed to the FE layer through the operator information base configuration, so that the chance of eliminating format conversion is found in the FE layer, format conversion processing is reduced, and network performance is improved.
According to the data format processing method provided by the embodiment of the application, when determining whether to insert the format conversion, the continuity of the data formats supported among a plurality of operators is considered, if the latter operator supports the format of the output data of the former operator, then the format conversion operator is determined not to be inserted between the two operators, and if the latter operator does not support the format of the output data of the former operator, then the format conversion operator is inserted between the two operators, so that the number of data conversion processing can be reduced, and the network performance is improved.
The foregoing description of the solution provided by the embodiments of the present invention has been presented mainly in terms of method steps. It is understood that the computer, in order to implement the above-described functions, includes corresponding hardware structures and/or software modules that perform the respective functions. Those of skill in the art will readily appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be implemented as a combination of hardware and computer software. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The embodiment of the application may divide the functional modules of the computer according to the above method example, for example, each functional module may be divided corresponding to each function, or two or more functions may be integrated into one processing module. The integrated modules may be implemented in hardware or in software functional modules. It should be noted that, in the embodiment of the present invention, the division of the modules is schematic, which is merely a logic function division, and other division manners may be implemented in actual implementation.
Fig. 11 shows a schematic diagram of a data format handling device 1100, which data format handling device 1100 may be used to implement the methods and functions involved in any of the embodiments described above.
The data format processing apparatus 1100 includes: a processing unit 1101 and an acquisition unit 1102. The processing unit 1101 is for controlling and managing the actions of the data format processing device, and for executing the processing performed by the processor in the foregoing embodiment, optionally, if the data format processing device 1100 includes a storage unit, the processing unit 1101 may further execute a program or instructions stored in the storage unit, so that the data format processing device 1100 implements the methods and functions related to any of the foregoing embodiments.
For example, the processing unit 1101 described above may be used to perform steps S702-S704 in fig. 7, and/or other processes for the techniques described herein. The acquisition unit 1102 may be used to perform, for example, acquiring data formats supported by the first and second computing units, and/or other processes for the techniques described herein. All relevant contents of each step related to the above method embodiment may be cited to the functional description of the corresponding functional module, which is not described herein.
Illustratively, in a hardware implementation, the functions of the processing unit 1101 may be performed by one processor, the functions of the obtaining unit 1102 may be performed by a communication interface, for example, the data formats supported by the first computing unit and the second computing unit may be obtained by an interface of the operator information base loading module. The processing unit 1101 may be embedded in hardware or may be independent of a processor of the data format processing device 1100, or may be stored in software in a memory of the data format processing device 1100, so that the processor may call and execute operations corresponding to the above functional units.
Embodiments of the present application also provide a computer-readable storage medium having instructions stored therein that, when executed on a computer, enable the computer to perform the data format processing method shown in fig. 7.
Embodiments of the present application also provide a computer program product which, when run on a computer, causes the computer to perform the data format processing method shown in fig. 7.
The embodiment of the application also provides electronic equipment, which comprises a processor and a memory, wherein the memory is coupled with the processor; the memory is used for storing computer program codes; the computer program code comprises computer instructions which, when executed by the processor, cause the electronic device to perform the data format processing method shown in fig. 7.
The embodiment of the application also provides electronic equipment, which comprises a central processing unit (CentralProcess Unit, CPU) and a Neural network processor (Neural-network Processing Unit, NPU), wherein the CPU is used for executing the data format processing method shown in FIG. 7, and the NPU is used for executing a computing network obtained by the CPU based on the data format processing method.
The steps of a method or algorithm described in connection with the disclosure herein may be embodied in hardware, or may be embodied in software instructions executed by a processor. The software instructions may be comprised of corresponding software modules that may be stored in random access memory (Random Access Memory, RAM), flash memory, erasable programmable read-only memory (Erasable Programmable ROM, EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disk, a removable disk, a compact disc read-only memory (CD-ROM), or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an ASIC. In addition, the ASIC may be located in a core network interface device. The processor and the storage medium may reside as discrete components in a core network interface device.
Those skilled in the art will appreciate that in one or more of the examples described above, the functions described in the present invention may be implemented in hardware, software, firmware, or any combination thereof. When implemented in software, these functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer-readable storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
The foregoing embodiments have been provided for the purpose of illustrating the general principles of the present invention in further detail, and are not to be construed as limiting the scope of the invention, but are merely intended to cover any modifications, equivalents, improvements, etc. based on the teachings of the invention.

Claims (15)

  1. A data format processing method, applied to a computing network, where the computing network sequentially includes a first computing unit and a second computing unit, the method comprising:
    Acquiring data formats supported by the first computing unit and the second computing unit;
    if the first computing unit is determined not to support the format of the input data of the first computing unit, adding a first format conversion unit before the first computing unit, wherein the first format conversion unit is used for converting the format of the input data of the first computing unit into a data format supported by the first computing unit;
    if the second computing unit is determined to support the format of the output data of the first computing unit, determining that format conversion processing is not performed between the first computing unit and the second computing unit.
  2. The method of claim 1, wherein, in the case where the first computing unit is a first computing unit in the computing network, the format of the input data of the first computing unit is the format of the original input data of the computing network.
  3. The method according to claim 1, wherein in case the first computing unit is a computing unit located at an intermediate position in the computing network, the format of the input data of the first computing unit is the format of the output data of a computing unit preceding the first computing unit.
  4. A method according to any of claims 1-3, wherein, in case the second computing unit supports a plurality of data formats, determining the format in which the second computing unit supports the output data of the first computing unit comprises:
    and if the plurality of data formats supported by the second computing unit comprise the format of the output data of the first computing unit, determining that the second computing unit supports the format of the output data of the first computing unit.
  5. The method of any of claims 1-4, wherein the obtaining the data formats supported by the first computing unit and the second computing unit comprises:
    acquiring preset mode types of the first computing unit and the second computing unit; the preset mode types comprise a format independent class, a reduced reduction class and a Broadcast class;
    and determining the data formats supported by the first computing unit and the second computing unit according to the preset mode types of the first computing unit and the second computing unit.
  6. The method according to any one of claims 1-5, further comprising:
    if the format of the output data of the last computing unit of the computing network is different from the format of the original output data of the computing network, adding a second format conversion unit after the last computing unit of the computing network, wherein the second format conversion unit is used for converting the format of the output data of the last computing unit into the format of the original output data of the computing network.
  7. A data format processing apparatus, applied to a computing network, the computing network comprising, in order, a first computing unit and a second computing unit, the apparatus comprising: a processing unit and an acquisition unit;
    the acquisition unit is used for acquiring the data formats supported by the first calculation unit and the second calculation unit;
    the processing unit is configured to add a first format conversion unit before the first computing unit if it is determined that the first computing unit does not support the format of the input data of the first computing unit, where the first format conversion unit is configured to convert the format of the input data of the first computing unit into a data format supported by the first computing unit;
    the processing unit is further configured to determine that format conversion processing is not performed between the first computing unit and the second computing unit if it is determined that the second computing unit supports the format of the output data of the first computing unit.
  8. The apparatus of claim 7, wherein, in the case where the first computing unit is a first computing unit in the computing network, the format of the input data of the first computing unit is the format of the original input data of the computing network.
  9. The apparatus of claim 7, wherein, in the case where the first computing unit is a computing unit located at an intermediate position in the computing network, the format of input data of the first computing unit is the format of output data of a computing unit preceding the first computing unit.
  10. The apparatus according to any of claims 7-9, wherein the processing unit is configured to determine that the second computing unit supports the format of the output data of the first computing unit if it is determined that the plurality of data formats supported by the second computing unit includes the format of the output data of the first computing unit.
  11. The device according to any one of claims 7 to 10, wherein,
    the acquisition unit is further used for acquiring preset mode types of the first calculation unit and the second calculation unit; the preset mode types comprise a format independent class, a reduced reduction class and a Broadcast class;
    the processing unit is further configured to determine a data format supported by the first computing unit and the second computing unit according to the preset mode types of the first computing unit and the second computing unit acquired by the acquiring unit.
  12. The apparatus according to any one of claims 7-11, wherein the processing unit is further configured to:
    if the format of the output data of the last computing unit of the computing network is different from the format of the original output data of the computing network, adding a second format conversion unit after the last computing unit of the computing network, wherein the second format conversion unit is used for converting the format of the output data of the last computing unit into the format of the original output data of the computing network.
  13. An electronic device comprising a processor and a memory, the memory coupled to the processor; the memory is used for storing computer program codes; the computer program code comprising computer instructions which, when executed by the processor, cause the electronic device to perform the method of any of claims 1-6.
  14. A computer readable storage medium comprising computer instructions which, when run on an electronic device, cause the electronic device to perform the method of any of claims 1-6.
  15. A computer program product, characterized in that the computer program product, when run on a computer, causes the computer to perform the method according to any of claims 1-6.
CN202080105412.5A 2020-09-28 2020-09-28 Data format processing method and device Pending CN116325703A (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/118563 WO2022061931A1 (en) 2020-09-28 2020-09-28 Data format processing method and apparatus

Publications (1)

Publication Number Publication Date
CN116325703A true CN116325703A (en) 2023-06-23

Family

ID=80846158

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202080105412.5A Pending CN116325703A (en) 2020-09-28 2020-09-28 Data format processing method and device

Country Status (2)

Country Link
CN (1) CN116325703A (en)
WO (1) WO2022061931A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114896950B (en) * 2022-07-11 2022-10-28 浙江大华技术股份有限公司 Model conversion method, model conversion device, and storage medium

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103491135B (en) * 2013-09-02 2017-04-19 用友网络科技股份有限公司 Device and method for conducting self-matching on data formats
CN103955447B (en) * 2014-04-28 2017-04-12 中国人民解放军国防科学技术大学 FFT accelerator based on DSP chip
CN111128402A (en) * 2019-12-20 2020-05-08 天津新开心生活科技有限公司 Data format conversion method and device, storage medium and electronic equipment
CN111176725B (en) * 2019-12-27 2022-05-06 北京市商汤科技开发有限公司 Data processing method, device, equipment and storage medium

Also Published As

Publication number Publication date
WO2022061931A1 (en) 2022-03-31

Similar Documents

Publication Publication Date Title
US11121949B2 (en) Distributed assignment of video analytics tasks in cloud computing environments to reduce bandwidth utilization
US20180157711A1 (en) Method and apparatus for processing query based on heterogeneous computing device
CN113033811B (en) Processing method and device for two-quantum bit logic gate
CN116325703A (en) Data format processing method and device
CN109272567B (en) Three-dimensional model optimization method and device
CN101986282A (en) Topological adaptation method and device
CN115906988A (en) Neural network inference architecture creation method, neural network inference method and device
US20100122241A1 (en) Executable template
CN116089895A (en) Operator fusion method and device
CN113111109A (en) Interface warehousing analysis access method of data source
CN111966383A (en) Quantitative analysis method, system and medium for operating system kernel compatibility
CN116185617A (en) Task processing method and device
US20120030235A1 (en) Priority search trees
CN111930441B (en) Consul-based configuration file management system and method
CN109408873B (en) Multi-dimensional array signal control method and device and computer readable storage medium
US20150309788A1 (en) Function module modularizing method in data distribution service and modularizing apparatus thereof
CN113742991A (en) Model and data joint optimization method and related device
CN113760380A (en) Method, device, equipment and storage medium for determining running code of network model
US20080313605A1 (en) Development framework for automated data throughput optimization
CN115378824B (en) Model similarity determination method, device, equipment and storage medium
CN114817117B (en) Protocol compatibility method, electronic equipment and computer readable storage device
JPH11232309A (en) Information processing system
CN115795342B (en) Method and device for classifying business scenes, storage medium and electronic equipment
EP4261691A1 (en) Method and device for optimizing computational graph
US20230023545A1 (en) Methods and systems for deep learning chip design generation

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination