Description File Parameters
The single-operator description file is a .json file consisting of OpDesc arrays. This section describes the parameters in the file.
|
Attribute Name |
Type |
Description |
Required |
|---|---|---|---|
|
compile_flag |
INT32 |
Deprecated. Compilation type.
Defaults to 0. Only operators of the Transformer network are supported currently. |
No |
|
op |
String |
Operator type. |
Yes |
|
name |
String |
Name of a single-operator model file. If name is not set, the default naming rule of the model file is SN_opType_Input description (dataType_format_shape)_Output description (dataType_format_shape), for example, 0_Add_3_2_3_3_3_2_3_3_3_2_3_3.om. You can check the enum values of dataType and format from the ${INSTALL_DIR}/include/graph/types.h file. The enum values are sorted in ascending order. Replace ${INSTALL_DIR} with the actual CANN component directory. If the Ascend-CANN-Toolkit package is installed as the root user, the CANN component directory is /usr/local/Ascend/ascend-toolkit/latest. |
No |
|
input_desc |
TensorDesc array |
Operator input description. |
Yes |
|
output_desc |
TensorDesc array |
Operator output description. |
Yes |
|
attr |
Attr array |
Operator attribute. |
No |
|
Attribute Name |
Type |
Description |
|---|---|---|
|
dynamic_input |
String |
(Optional) Dynamic input. Must be the same as the input name field defined in the operator information library. Assume that an operator has two groups of dynamic inputs, which are defined as follows: .DYNAMIC_INPUT(x,...) .DYNAMIC_INPUT(y,...) where two groups of dynamic inputs are defined (x and y). The number of inputs in each group is determined by the number of dynamic_input fields. For details, see the description of the name parameter in the TensorDesc array.
|
|
format |
String |
(Required) Tensor format supported by the original operator framework. The mapping between the possible formats and enum values is as follows:
After your model is converted, you will see the supported format represented as the corresponding enum value in the file name of the generated offline model (.om file). For example, 1 maps to format NHWC. |
|
origin_format |
String |
(Optional) Original format of the tensor. If this field is not included, the implemented format of a tensor is the same as the original format by default. |
|
name |
String |
(Optional) Tensor name. Required when the operator has dynamic inputs. This parameter sets the input names in each group of dynamic inputs. Each input name consists of the input name defined in the operator prototype plus an ID, which is indexed starting at 0.
|
|
shape |
Array of ints |
(Required) Tensor shape, for example, [1, 224, 224, 3]. The actual shape product cannot be greater than the maximum int32 value (2147483647).
|
|
origin_shape |
String |
(Optional) Original shape of the tensor. If this field is not included, the implemented shape of a tensor is the same as the original shape by default. |
|
type |
String |
(Required) Tensor data type. The mapping between the possible data types and enum values is as follows.
After your model is converted, you will see the supported data type represented as the corresponding enum value in the file name of the generated offline model. For example, 2 maps to type int8. |
|
shape_range |
int[2] array |
(Optional) Value range of an unknown/dynamic shape (excluding shape = -2). For example, for shape [16, -1, 20, -1], -1 indicates an unknown dimension. Assume that shape_range is [1, 128], [1, -1], where [1, 128] indicates the value range from 1 to 128, corresponding to the first -1 dimension in the shape value, and [1, -1] indicates the value range from 1 to infinity, corresponding to the second -1 dimension accordingly. |
|
is_const |
bool |
(Optional) Whether the input is a constant.
|
|
const_value |
list |
(Optional) Constant value. Currently, const_value supports only a one-dimensional list. The number of lists to configure is determined by the value of shape. For example, if the value of shape is 2, there are two lists in const_value. The data type of const_value is determined by type. If type is set to float16, single-operator build automatically converts const_value to the float16 format. |
|
Attribute Name |
Type |
Description |
|---|---|---|
|
name |
String |
(Required) Attribute name |
|
type |
String |
(Required) Attribute data type:
|
|
value |
Determined by type |
(Required) Attribute value. Varies according to type.
|

