Fields in the TBE Operator ST Case Definition File
Field |
Description |
|
|---|---|---|
Test_xxx_xx |
- |
Mandatory. A string. Test case name. |
Input[xx] |
- |
Mandatory. Operator input. NOTICE:
The number of parameter values in each input of an operator must be the same. Otherwise, test case generation fails. For example, if the Input[01] supports two formats, the Input[02] also supports two formats. Similarly, the parameter values of type, shape, data_distribute, and value_range in all Input[xx] must be the same. |
- |
Name |
Mandatory. Operator input name, which is of the string type. If the expectation function is configured, the operator input name must be the same as that input in the expectation function. |
- |
Format |
Mandatory. A string or a 1D array of strings. Format of the input tensor. Must not be empty. Common data formats are as follows:
Note that the numbers of formats, types, and shapes must be the same. |
- |
OriginFormat |
Optional. Original tensor format. If this parameter is not carried, the original tensor format is retained. |
- |
ShapeRange |
Optional. Value range of a dynamic shape. The default value is [1, -1]. For example, if Shape is [16, -1, 16, -1], -1 indicates an unknown shape. If ShapeRange is [[1, 128], [1, -1]], [1, 128] indicates that the value of the first -1 in Shape ranges from 1 to 128. [1, -1] indicates that the value of the second -1 in Shape ranges from 1 to infinity. |
- |
TypicalShape |
Static shape, which is used to generate available test data. |
- |
Type |
Mandatory. A string or a 1D array of strings. All input and output tensors must support the same number of data types. Input data type.
Note that the numbers of formats, types, and shapes must be the same. |
- |
Shape |
Mandatory. An int or a 1D or 2D array of ints. Input tensor shape. All input and output tensors must support the same number of shapes. Example: [8, 3, 256, 256] or [[1, 3, 256, 256], [8, 3, 256, 256]]. If you enter an invalid shape, for example, [0], an error is reported. Note that the numbers of formats, types, and shapes must be the same. |
- |
OriginShape |
Optional. Original tensor shape. If this field is not carried, the original tensor shape is retained. |
- |
Value |
Optional. Path string or tensor array. If you need to specify the input data, you can add the Value field. There are two configuration methods:
Prepare the .bin file by yourself. You can enter an absolute path. If the Value field is added, the DataDistribute and ValueRange fields will be hidden. In addition, ensure that the Value field matches the Format, Type, and Shape fields. Each test case supports one data type only. |
- |
ValueRange |
Mandatory. An int or float, or a 1D or 2D array of ints or floats. Value range. Must not be left empty. Formatted as [min_value, max_value], with min_value <= max_value. |
- |
DataDistribute |
Mandatory. A string or a 1D array of strings. Data distribution mode for generating test data.
|
- |
isConst |
Optional. The value is of the Bool type. The default value is false.
|
Output[xx] |
- |
Mandatory. Operator output. NOTICE:
The number of values in Output must be the same as that in Input. Otherwise, test case generation fails. For example, if Input supports two formats, the Output also supports two formats. |
- |
Name |
Mandatory. Operator input name, which is of the string type. If the expectation function is configured, the operator output name must be the same as that output from the expectation function. |
- |
Format |
Mandatory. A string or a 1D array of strings. Format of the output tensor. Must not be empty. Common data formats are as follows:
Note that the numbers of formats, types, and shapes must be the same. |
- |
OriginFormat |
Optional. Original tensor format. If this parameter is not carried, the original tensor format is retained. |
- |
Type |
Mandatory. A string or a 1D array of strings. Output data type.
Note that the numbers of formats, types, and shapes must be the same. |
- |
Shape |
Mandatory. An int or a 1D or 2D array of ints. Input tensor shape. Example: [8, 3, 256, 256] or [[1, 3, 256, 256], [8, 3, 256, 256]]. If you enter an invalid shape, for example, [0], an error is reported. Note that the numbers of formats, types, and shapes must be the same. |
- |
OriginShape |
Optional. Original tensor shape. If this field is not carried, the original tensor shape is retained. |
Attribute |
- |
Optional. |
- |
Name |
Required if attr is configured. A string. Attribute name. Must not be empty. |
- |
Type |
Required if attr is configured. Attribute data type. A string. Output data type.
|
- |
Value |
Required if attr is configured. Must not be null. A string. Attribute value. Varies according to type.
|
Expected Result Verification |
- |
Optional. |
- |
Script Path |
Optional. Path of the string type. Path of the test function for generating expected operator result. |
- |
Script Function |
Optional. A string. Name of the test function for generating expected operator result. |
K-Level Test Cases |
- |
Optional. |
- |
Fuzz Script Path |
Optional. Path of the string type. Relative or absolute path of the fuzz testing script. |
- |
Fuzz Function |
Optional. A string. Name of the function for generating fuzzing input in the fuzzing script. The default value is fuzz_branch. |
- |
Fuzz Case Num |
Optional. An int. Number of test cases generated using a script. The value range is [1, 2000]. |
- When inputx.paramType in the operator information library definition file (.ini) is set to optional, set format of inputx to UNDEFINED or RESERVED, and type to UNDEFINED in the generated operator test cases.
- If a dimension of Shape is -1 or Shape is [-2] (a dimension is -1. For example, [200, -1] indicates that the length of the second axis is unknown, and [-2] indicates that the dimension is unknown), the ShapeRange and TypicalShape fields are added to the generated operator test cases. The value of ShapeRange is [[1,-1]], indicating that the Shape parameter can be set to any value. You need to provide the static shape value in the TypicalShape field for actual tests.
- In the operator information library definition file (.ini), if a tensor implementation uses a Huawei-developed format and is different from the original format, you need to manually enter the original format and shape in OriginFormat and OriginShape to convert the format and shape into those compatible with the offline model.
- OriginFormat is an array specifying the formats supported by the original operator. The array must have the same length as the Format array.
- The value of OriginShape must correspond to the value of Shape and match the values of Format and OriginFormat.
- All parameters except Type of name and Attr in Input[xx], Output[xx], and Attr support fuzz input.
