news 2026/9/10 4:39:38

CANN/GE GNode属性获取API

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
CANN/GE GNode属性获取API

GetAttr

【免费下载链接】geGE(Graph Engine)是面向昇腾的图编译器和执行器,提供了计算图优化、多流并行、内存复用和模型下沉等技术手段,加速模型执行效率,减少模型内存占用。 GE 提供对 PyTorch、TensorFlow 前端的友好接入能力,并同时支持 onnx、pb 等主流模型格式的解析与编译。项目地址: https://gitcode.com/cann/ge

产品支持情况

全量芯片支持。

头文件/库文件

  • 头文件:#include <graph/gnode.h>
  • 库文件:libgraph.so

功能说明

获取指定属性名字的值。

函数原型

graphStatus GetAttr(const AscendString &name, int64_t &attr_value) const graphStatus GetAttr(const AscendString &name, int32_t &attr_value) const graphStatus GetAttr(const AscendString &name, uint32_t &attr_value) const graphStatus GetAttr(const AscendString &name, float32_t &attr_value) const graphStatus GetAttr(const AscendString &name, AscendString &attr_value) const graphStatus GetAttr(const AscendString &name, bool &attr_value) const graphStatus GetAttr(const AscendString &name, Tensor &attr_value) const graphStatus GetAttr(const AscendString &name, std::vector<int64_t> &attr_value) const graphStatus GetAttr(const AscendString &name, std::vector<int32_t> &attr_value) const graphStatus GetAttr(const AscendString &name, std::vector<uint32_t> &attr_value) const graphStatus GetAttr(const AscendString &name, std::vector<float32_t> &attr_value) const graphStatus GetAttr(const AscendString &name, std::vector<AscendString> &attr_values) const graphStatus GetAttr(const AscendString &name, std::vector<bool> &attr_value) const graphStatus GetAttr(const AscendString &name, std::vector<Tensor> &attr_value) const graphStatus GetAttr(const AscendString &name, OpBytes &attr_value) const graphStatus GetAttr(const AscendString &name, std::vector<std::vector<int64_t>> &attr_value) const graphStatus GetAttr(const AscendString &name, std::vector<ge::DataType> &attr_value) const graphStatus GetAttr(const AscendString &name, ge::DataType &attr_value) const graphStatus GetAttr(const AscendString &name, AttrValue &attr_value) const

参数说明

参数名输入/输出说明
name输入属性名称。
attr_value输出返回的int64_t表示的整型类型属性值。
attr_value输出返回的int32_t表示的整型类型属性值。
attr_value输出返回的uint32_t表示的整型类型属性值。
attr_value输出返回的浮点类型float的属性值。
attr_value输出返回的字符串类型AscendString的属性值。
attr_value输出返回的布尔类型bool的属性值。
attr_value输出返回的Tensor类型的属性值。
attr_value输出返回的vector<int64_t>表示的整型列表类型属性值。
attr_value输出返回的vector<int32_t>表示的整型列表类型属性值。
attr_value输出返回的vector<uint32_t>表示的整型列表类型属性值。
attr_value输出返回的浮点列表类型vector<float>的属性值。
attr_value输出返回的字符串列表类型vector<ge::AscendString>的属性值。
attr_value输出返回的布尔列表类型vector<bool>的属性值。
attr_value输出返回的Tensor列表类型vector<Tensor>的属性值。
attr_value输出返回的Bytes,即字节数组类型的属性值,OpBytes即vector<uint8_t>。
attr_value输出返回的vector<vector<int64_t>>表示的整型二维列表类型属性值。
attr_value输出返回的vector<ge::DataType>表示的DataType列表类型属性值。
attr_value输出返回的DataType类型的属性值。
attr_value输出返回的AttrValue类型的属性值。

返回值说明

参数名类型说明
-graphStatusGRAPH_SUCCESS(0):成功。
其他值:失败。

约束说明

【免费下载链接】geGE(Graph Engine)是面向昇腾的图编译器和执行器,提供了计算图优化、多流并行、内存复用和模型下沉等技术手段,加速模型执行效率,减少模型内存占用。 GE 提供对 PyTorch、TensorFlow 前端的友好接入能力,并同时支持 onnx、pb 等主流模型格式的解析与编译。项目地址: https://gitcode.com/cann/ge

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/9/10 4:38:48

AutoHedge:面向Swarm的LLM服务语义健康网关

1. AutoHedge 是什么&#xff1f;它解决的不是“自动对冲”&#xff0c;而是工程协同失效的根因问题 AutoHedge 这个名字乍看像金融风控里的高频术语——自动对冲&#xff08;Automatic Hedging&#xff09;&#xff0c;但结合热搜词 Swarm、API、OpenAI、Python&#xff0c;再…

作者头像 李华
网站建设 2026/9/10 4:36:29

Happy-LLM 教程导读:从零开始构建大模型的学习路线与实践指南

Happy-LLM 教程导读&#xff1a;从零开始构建大模型的学习路线与实践指南 【免费下载链接】happy-llm &#x1f4da; 从零开始构建大模型 项目地址: https://gitcode.com/GitHub_Trending/ha/happy-llm 本篇文章是 Datawhale 开源项目 Happy-LLM&#xff08;仓库路径 doc…

作者头像 李华
网站建设 2026/9/10 4:36:18

WavLM 全栈语音预训练模型解析与 Transformers 实战指南

WavLM 全栈语音预训练模型解析与 Transformers 实战指南 【免费下载链接】transformers &#x1f917; Transformers: the model-definition framework for state-of-the-art machine learning models in text, vision, audio, and multimodal models, for both inference and …

作者头像 李华