AddListString

Description

Adds a string to the list of strings for the attribute value.

Prototype

void AddListString(const std::string &string)

Parameters

Parameter

Input/Output

Description

string

Input

String

Returns

None

Restrictions

None

Example

The following gives the prototype definition of an operator whose OpType is A, with attribute name set to attr1 and type ListString.

For details about the supported data types of the attribute in the .ATTR API, see API Description.

REG_OP(A)
    .INPUT(x, TensorType({ DT_FLOAT }))
    .OUTPUT(y, TensorType({ DT_FLOAT }))
    .ATTR(attr1, ListString, {})
    .OP_END_FACTORY_REG(A)

In this case, you can use the following API during operator implementation to add an attribute value of type string for operator A.

AttrValue *attr = ctx.GetAttr("attr1");
std::string str = "seed";
attr->AddListString(str);