ListTensorShapeSize
Description
Obtains the number of TensorShapes on the list of TensorShapes for AttrValue.
Prototype
int32_t ListTensorShapeSize() const
Parameters
None
Returns
int32_t for the number of TensorShape elements on the list of TensorShapes for AttrValue.
Restrictions
None
Example
The following gives the prototype definition of an operator whose OpType is A, with attribute name set to attr1 and type ListTensorShape.
REG_OP(A)
.INPUT(x, TensorType({ DT_FLOAT }))
.OUTPUT(y, TensorType({ DT_FLOAT }))
.ATTR(attr1, ListTensorShape, {})
.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->ListTensorShapeSize();
Parent topic: Class AttrValue