Fields in the TBE Operator UT Case Definition File

Table 1 TBE operator UT case definition file (.json)

Parameter

Description

Operator[xx]

-

Optional.

-

OpName

Operator name.

-

TestName

Mandatory. Test case name.

-

SocVersion

Mandatory. Supported types of the Ascend AI Processor.

You can enter all, indicating that all of the Ascend AI Processors are supported.

-

FunctionType

Mandatory. Supported function types. Corresponding parameters are as follows:

  • add_precision_case: Adds a precision test case for the current operator.
  • add_case: Adds an operator compilation test for the current operator to test whether the operator supports this specification and can compile an .o file.

Input[xx]

-

Mandatory.

Operator input.

-

Name

Optional. Operator input name, which is of the string type.

-

Format

Mandatory.

A string.

Format of the input tensor. Must not be empty.

Common data formats are as follows:

  • NCHW
  • NHWC
  • ND: any format.
  • NC1HWC0: a 5D format defined by Huawei. C0 is closely related to the micro-architecture, and the value is equal to the Cube Unit size, for example, 16. C1 is obtained by dividing the C dimension by C0, that is, C1 = C/C0. When the division is not exact, the last data segment is padded to C0.
  • FRACTAL_Z: a format of the convolution weight.
  • FRACTAL_NZ: fractal format defined by Huawei. The data format of the output matrix is NW1H1H0W0 during Cube Unit computation. The matrix is divided into (H1 x W1) fractals in column-major order, which looks like an N-shape layout. Each fractal consists of (H0 x W0) elements in row-major order, resembling a z-shaped layout. Therefore the NW1H1H0W0 format is referred to as the Nz format. (H0 x W0) indicates the size of a fractal, as shown in the following figure.

-

OriginFormat

Optional. Original tensor format.

If this parameter is not carried, the original tensor format is retained.

-

Type

Mandatory.

A string.

All input and output tensors must support the same number of data types.

Input data type.

  • bool
  • int8
  • uint8
  • int16
  • uint16
  • int32
  • int64
  • uint32
  • uint64
  • float16
  • float

-

Shape

Mandatory.

An int or a 1D array of ints.

Input tensor shape. All input and output tensors must support the same number of shapes.

For example:

[8, 3, 256, 256].

If you enter an invalid shape, for example, [0], an error is reported.

Note that the configured shape must match the format.

-

OriginShape

Optional. Original tensor shape.

If this field is not carried, the original tensor shape is retained.

Output[xx]

-

Mandatory.

Operator output.

-

Name

Operator input name, which is of the string type.

-

Format

Mandatory.

A string.

Format of the output tensor. Must not be empty.

Common data formats are as follows:

  • NCHW
  • NHWC
  • ND: any format.
  • NC1HWC0: a 5D format defined by Huawei. C0 is closely related to the micro-architecture, and the value is equal to the Cube Unit size, for example, 16. C1 is obtained by dividing the C dimension by C0, that is, C1 = C/C0. When the division is not exact, the last data segment is padded to C0.
  • FRACTAL_Z: a format of the convolution weight.
  • FRACTAL_NZ: fractal format defined by Huawei. The data format of the output matrix is NW1H1H0W0 during Cube Unit computation. The matrix is divided into (H1 x W1) fractals in column-major order, which looks like an N-shape layout. Each fractal consists of (H0 x W0) elements in row-major order, resembling a z-shaped layout. Therefore the NW1H1H0W0 format is referred to as the Nz format. (H0 x W0) indicates the size of a fractal, as shown in the following figure.

-

OriginFormat

Optional. Original tensor format.

If this parameter is not carried, the original tensor format is retained.

-

Type

Mandatory.

A string.

Output data type.

  • bool
  • int8
  • uint8
  • int16
  • uint16
  • int32
  • int64
  • uint32
  • uint64
  • float16
  • float

-

Shape

Mandatory.

An int or a 1D or 2D array of ints.

Input tensor shape.

For example:

[8, 3, 256, 256].

If you enter an invalid shape, for example, [0], an error is reported.

-

OriginShape

Optional. Original tensor shape.

If this field is not carried, the original tensor shape is retained.

Attribute

-

Optional.

-

Name

Optional. A string.

-

Type

Required if attr is configured. Attribute data type.

A string.

Output data type.

  • bool
  • int
  • float
  • string
  • list_bool
  • list_int
  • list_float
  • list_string
  • list_list_int

-

Value

Required if attr is configured. Must not be null.

A string.

Attribute value. Varies according to type.

  • bool: true/false
  • int: 10
  • float: 1.0
  • string: "NCHW"
  • list_bool: [false, true]
  • list_int: [1, 224, 224, 3]
  • list_float: [1.0, 0.0]
  • list_string: ["str1", "str2"]
  • list_list_int: [[1, 3, 5, 7], [2, 4, 6, 8]]