ListFloatSize

Description

Obtains the number of floats on the list of floats for the attribute value.

Prototype

int32_t ListFloatSize() const

Parameters

None

Returns

int32_t for the number of floats on the list of floats.

Restrictions

None

Example

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

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

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

AttrValue *attr = ctx.GetAttr("attr1");
int32_t size = attr->ListFloatSize();