文档
注册

GetString

函数功能

获取string类型的属性值。

函数原型

std::string GetString() const

参数说明

无。

返回值说明

返回的属性值,std::string类型。

约束说明

无。

调用示例

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

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

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

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

AttrValue *attr = ctx.GetAttr("attr1");
std::string str = attr->GetString();
搜索结果
找到“0”个结果

当前产品无相关内容

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