IR Definition Configuration

  • Excel file parameter description
    Table 1 Parameters in IR prototype definition

    Column Header

    Description

    Mandatory or Not

    Op

    Operator type.

    Yes

    Classify

    Parameter classification.
    • Input
    • DYNAMIC_INPUT
    • Output
    • DYNAMIC_OUTPUT
    • Attr

    Yes

    Name

    Parameter name.

    Yes

    Type

    Parameter data type.

    Value range:

    tensor, int, bool, float, ListInt, ListFloat, and more

    Yes

    TypeRange

    Tensor data types.

    Value range:

    fp16, fp32, double, int8, int16, int32, int64, uint8, uint16, uint32, uint64, bool, and more

    Selected from the following equivalents in the MindSpore scenario:

    I8_Default, I16_Default, I32_Default, I64_Default, U8_Default, U16_Default, U32_Default, U64_Default, BOOL_Default, and more

    No

    Required

    Whether an input is required:

    • TRUE
    • FALSE

    Yes

    Doc

    Parameter description.

    No

    Attr_Default_value

    Default value of an attribute.

    No

    Format

    Tensor formats.

    Value range:

    ND, NHWC, NCHW, HWCN, NC1HWC0, FRACTAL_Z, and more

    No

  • JSON IR file parameter description
    For details about how to configure the JSON IR file for creating an operator project, see Table 2.
    Table 2 JSON file parameter description

    Parameter

    Type

    Description

    Mandatory or Not

    Plugin Framework

    -

    List

    Original framework of the operator.

    • MindSpore
    • PyTorch
    • TensorFlow
    • Caffe
    • ONNX

    Yes

    Op Type

    -

    String

    Operator type.

    The value allows letters and digits, and the first letter must be capitalized.

    Yes

    Input[xx]

    -

    List

    Input description.

    No

    Name

    String

    Input name.

    Yes

    Format

    String or list

    Tensor formats. If multiple tensor formats are supported, use a list, for example, ["ND","NHWC"].

    Value range:

    ND, NHWC, NCHW, HWCN, NC1HWC0, FRACTAL_Z, and more

    No

    Data Type

    String or list

    Input data type.

    Value range:

    int32, uint64, float16, float, uint16, int16, int64, uint32, bool, int8, uint8, and so on.

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

    Yes

    Param Type

    -

    Parameter type.

    • Required
    • Optional
    • Dynamic

    If this parameter is not set, the default value Required is used.

    Yes

    Output[xx]

    -

    List

    Output description.

    Yes

    Name

    String

    Output name.

    Yes

    Format

    String or list

    Tensor formats.

    Value range:

    ND, NHWC, NCHW, HWCN, NC1HWC0, FRACTAL_Z, and more

    No

    Data Type

    String or list

    Output data type:

    Value range:

    int32, uint64, float16, float, uint16, int16, int64, uint32, bool, int8, uint8, and so on.

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

    Yes

    Param Type

    -

    Parameter type.

    • Required
    • Optional
    • Dynamic

    If this parameter is not set, the default value Required is used.

    Yes

    Attribute[xx]

    -

    List

    Attribute description.

    No

    Name

    String

    Attribute name.

    Yes

    Type

    String or list

    Parameter data type.

    Value range:

    int, bool, float, string, list_int, list_float, and more

    For MindStudio, the options are as follows:

    I8_Default, I16_Default, I32_Default, I64_Default, U8_Default, U16_Default, U32_Default, U64_Default, BOOL_Default, and more

    Yes

    Default Value

    -

    Default value.

    No

    Param Type

    -

    Parameter type.

    • Required
    • Optional

    If this parameter is not set, the default value Required is used.

    Yes

    Multiple operators can be configured for an IR template. You can click Add to add operators.

    • For operators with the same Op Type field, the operator project will be created based on the operator that comes last on the list.
    • If Input[xx] of an operator has identical Name fields, the Name field that comes last on the list takes precedence. This rule also applies to Output[xx].
    • For Input[xx] or Output[xx], the supported data types set on the Data Type list match the supported formats set on the Format list with the ordering preserved. In the event of no Format list, ND is used as a substitution.

    Examples:

    Plugin Framework

    -

    TensorFlow

    Op Type

    -

    Conv2D

    Input[01]

    -

    -

    Name

    x

    Format

    ["NCHW"]

    Data Type

    ["fp16"]

    Param Type

    Required

    Input[02]

    -

    -

    Name

    filter

    Format

    ["NCHW"]

    Data Type

    ["fp16"]

    Param Type

    Required

    Output[01]

    -

    -

    Name

    y

    Format

    ["NCHW"]

    Data Type

    ["fp16"]

    Param Type

    Required

    Attribute[01]

    -

    -

    Name

    strides

    Type

    list_int

    Default Value

    -

    Param Type

    Required

    Attribute[02]

    -

    -

    Name

    pads

    Type

    list_int

    Default Value

    -

    Param Type

    Required

    Attribute[03]

    -

    -

    Name

    dilations

    Type

    list_int

    Default Value

    [1,1,1,1]

    Param Type

    Optional