获取list Tensor类型的属性值。
std::vector<Tensor> GetListTensor() const
无
std::vector<Tensor>,AttrValue的list Tensor类型的属性值。
无。
例如,OpType为A的算子的原型定义如下所示,属性的名称为attr1,类型为ListTensor。
.ATTR接口中属性类型的取值范围可参见接口说明。
REG_OP(A) .INPUT(x, TensorType({ DT_FLOAT })) .OUTPUT(y, TensorType({ DT_FLOAT })) .ATTR(attr1, ListTensor, {}) .OP_END_FACTORY_REG(A)
则算子实现时可使用如下接口获取算子A的属性值。
AttrValue *attr = ctx.GetAttr("attr1"); std::vector<Tensor> tensors = attr->GetListTensor();