GetListBool

Description

Obtains the attribute value in the form of list of bools.

Prototype

std::vector<bool> GetListBool() const

Parameters

None

Returns

std::vector<bool> for the attribute value.

Restrictions

None

Example

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

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, ListBool, {true})
    .OP_END_FACTORY_REG(A)

In this case, you can use the following API during operator implementation to obtain operator A's attribute value.

AttrValue *attr = ctx.GetAttr("attr1");
std::vector<bool> values = attr->GetListBool();