Output

Function Usage

In some scenarios, an operator supports different prototype outputs on different AI processor models.

This API can register differentiated operator outputs for different AI processor models. After this API is called, an OpParamDef structure is returned. You can use this structure to configure operator outputs.

Prototype

OpParamDef &Output(const char *name);

Parameters

Parameter

Input/Output

Description

name

Input

Operator output name.

Returns

Operator parameter definition. For details about OpParamDef, see OpParamDef.

Constraints

None

Example

class AddCustom : public OpDef {
public:
    AddCustom(const char* name) : OpDef(name)
    {
        this->Input("x").DataType({ ge::DT_FLOAT16 }).ParamType(OPTIONAL);
        this->Output("y").DataType({ ge::DT_FLOAT16 });
        OpAICoreConfig aicConfig1;
        OpAICoreConfig aicConfig2;
        aicConfig1.Output("y")
            .ParamType(OPTIONAL)
            .DataType({ ge::DT_FLOAT })
            .Format({ ge::FORMAT_ND });
        aicConfig2.Output("y")
            .ParamType(REQUIRED)
            .DataType({ ge::DT_INT32 })
            .Format({ ge::FORMAT_ND });
        this->AICore().AddConfig("ascendxxx1", aicConfig1);
        this->AICore().AddConfig("ascendxxx2", aicConfig2);
    }
};