news 2026/9/10 3:35:12

昇腾/GE:GetInputAttr算子输入属性获取

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
昇腾/GE:GetInputAttr算子输入属性获取

GetInputAttr

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

产品支持情况

全量芯片支持。

头文件和库文件

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

功能说明

根据属性名称获取算子输入Tensor对应的属性值。

函数原型

graphStatus GetInputAttr(const int32_t index, const char_t *name, AscendString &attr_value) const graphStatus GetInputAttr(const char_t *dst_name, const char_t *name, AscendString &attr_value) const graphStatus GetInputAttr(const int32_t index, const char_t *name, int64_t &attr_value) const graphStatus GetInputAttr(const char_t *dst_name, const char_t *name, int64_t &attr_value) const graphStatus GetInputAttr(const int32_t index, const char_t *name, int32_t &attr_value) const graphStatus GetInputAttr(const char_t *dst_name, const char_t *name, int32_t &attr_value) const graphStatus GetInputAttr(const int32_t index, const char_t *name, uint32_t &attr_value) const graphStatus GetInputAttr(const char_t *dst_name, const char_t *name, uint32_t &attr_value) const graphStatus GetInputAttr(const int32_t index, const char_t *name, bool &attr_value) const graphStatus GetInputAttr(const char_t *dst_name, const char_t *name, bool &attr_value) const graphStatus GetInputAttr(const int32_t index, const char_t *name, float32_t &attr_value) const graphStatus GetInputAttr(const char_t *dst_name, const char_t *name, float32_t &attr_value) const graphStatus GetInputAttr(const int32_t index, const char_t *name, std::vector<AscendString> &attr_value) const graphStatus GetInputAttr(const char_t *dst_name, const char_t *name, std::vector<AscendString> &attr_value) const graphStatus GetInputAttr(const int32_t index, const char_t *name, std::vector<int64_t> &attr_value) const graphStatus GetInputAttr(const char_t *dst_name, const char_t *name, std::vector<int64_t> &attr_value) const graphStatus GetInputAttr(const int32_t index, const char_t *name, std::vector<int32_t> &attr_value) const graphStatus GetInputAttr(const char_t *dst_name, const char_t *name, std::vector<int32_t> &attr_value) const graphStatus GetInputAttr(const int32_t index, const char_t *name, std::vector<uint32_t> &attr_value) const graphStatus GetInputAttr(const char_t *dst_name, const char_t *name, std::vector<uint32_t> &attr_value) const graphStatus GetInputAttr(const int32_t index, const char_t *name, std::vector<bool> &attr_value) const graphStatus GetInputAttr(const char_t *dst_name, const char_t *name, std::vector<bool> &attr_value) const graphStatus GetInputAttr(const int32_t index, const char_t *name, std::vector<float32_t> &attr_value) const graphStatus GetInputAttr(const char_t *dst_name, const char_t *name, std::vector<float32_t> &attr_value) const

参数说明

参数名输入/输出描述
name输入属性名称。
index输入输入索引。
dst_name输入输入边名称。
attr_value输出获取到的int64_t表示的整型类型属性值。
attr_value输出获取到的int32_t表示的整型类型属性值。
attr_value输出获取到的uint32_t表示的整型类型属性值。
attr_value输出获取到的vector<int64_t>表示的整型列表类型属性值。
attr_value输出获取到的vector<int32_t>表示的整型列表类型属性值。
attr_value输出获取到的vector<uint32_t>表示的整型列表类型属性值。
attr_value输出获取到的浮点类型的属性值。
attr_value输出获取到的浮点列表类型的属性值。
attr_value输出获取到的布尔类型的属性值。
attr_value输出获取到的布尔列表类型的属性值。
attr_value输出获取到的字符串类型的属性值。
attr_value输出获取到的字符串列表类型的属性值。

返回值说明

graphStatus类型:找到对应属性,返回GRAPH_SUCCESS,否则返回GRAPH_FAILED。

异常处理

无。

约束说明

无。

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

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

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

两节点电力系统高斯-赛德尔潮流计算MATLAB实现与解析

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

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

基于NSGA-II的水电光伏多能互补协调优化调度MATLAB实现

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

作者头像 李华