文档
注册
评分
提单
论坛
小AI

ListIntSize

函数功能

获取list int类型的属性中int元素的个数。

函数原型

int32_t ListIntSize() const

参数说明

无。

返回值说明

返回list int类型的属性中int元素的个数,int32_t类型。

约束说明

无。

调用示例

例如,OpType为A的算子的原型定义如下所示,属性的名称为attr1,类型为ListInt。

.ATTR接口中属性类型的取值范围可参见接口说明

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

则算子实现时可使用如下接口获取算子A的属性值的长度。

AttrValue *attr = ctx.GetAttr("attr1");
int32_t size = attr->ListIntSize();
搜索结果
找到“0”个结果

当前产品无相关内容

未找到相关内容,请尝试其他搜索词