文档
注册

ListTensorShapeSize

函数功能

获取AttrValue的list TensorShape属性中TensorShape元素个数。

函数原型

int32_t ListTensorShapeSize() const

参数说明

返回值说明

uint32_t,AttrValue的list TensorShape属性中TensorShape元素个数。

约束说明

无。

调用示例

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

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

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

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

当前产品无相关内容

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