目录

Follow

Function Description

Specifies that the data type, format, and shape of the current input or output are the same as those of a previously defined input.

Function Prototype

OpParamDef &Follow(const char *paramName);
OpParamDef &Follow(const char *paramName, FollowType ftype);

Parameters

Parameter Input/Output Description
paramName Input Input name that has been defined.
ftype Input

Enumeration type of FollowType, indicating the follow type. The options are as follows:

- ALL: The data type, format, and shape are the same as those of paramName.

- DTYPE: The data type is the same as that of paramName.

- FORMAT: The format is the same as that of paramName.

- SHAPE: The shape is the same as that of paramName.

Return Value

OpParamDef operator definition.

Restrictions

Calling Example

If the output y1 follows the input x1, the data type, format, and shape of y1 are the same as those of x1.

this->Input("x1")
    .ParamType(REQUIRED)
    .DataType({ge::DT_FLOAT, ge::DT_FLOAT})
    .Format({ge::FORMAT_ND, ge::FORMAT_ND});
this->Input("x2")
    .ParamType(REQUIRED)
    .DataType({ge::DT_FLOAT, ge::DT_FLOAT})
    .Format({ge::FORMAT_ND, ge::FORMAT_ND});
this->Output("y1")
    .ParamType(REQUIRED)
    .Follow("x1")
    .OutputShapeDependOnCompute();