SetListString
Description
Sets an attribute value in the form of list of strings.
Prototype
void SetListString(const std::vector<std::string> &bytes)
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
bytes |
Input |
Attribute value in the form of list of strings. |
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 the REG_OP 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 set operator A's attribute value.
AttrValue *attr = ctx.GetAttr("attr1");
std::vector<std::string> strs;
strs.push_back("seed1");
strs.push_back("seed2");
attr->SetListString(strs);
Parent topic: Class AttrValue