昇腾CANN/GE ArgsFormat反序列化接口
2026/9/10 5:01:54 网站建设 项目流程

Deserialize

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

产品支持情况

全量芯片支持。

头文件/库文件

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

函数功能

ArgsFormat的反序列化接口。

函数原型

static std::vector<ArgDescInfo> Deserialize(const AscendString &args_str)

参数说明

参数名输入/输出描述
args_str输入ArgsFormat的序列化字符串。

返回值

返回ArgsFormat。

失败时,返回空的vector。

约束说明

字符串必须是ArgsFormat的序列化结果。

调用示例

graphStatus Mc2GenTaskCallback(const gert::ExeResGenerationContext *context, std::vector<std::vector<uint8_t>> &tasks) { .... // 更改原AI Core任务的ArgsFormat auto aicore_task = KernelLaunchInfo::LoadFromData(context, tasks.back()); auto aicore_args_format_str = aicore_task.GetArgsFormat(); auto aicore_args_format = ArgsFormatSerializer::Deserialize(aicore_args_format_str); size_t i = 0UL; for (; i < aicore_args_format.size(); i++) { if (aicore_args_format[i].GetType() == ArgDescType::kIrInput || aicore_args_format[i].GetType() == ArgDescType::kInputInstance) { break; } } aicore_args_format.insert(aicore_args_format.begin() + i, ArgDescInfo::CreateHiddenInput(HiddenInputSubType::kHcom)); aicore_task.SetArgsFormat(ArgsFormatSerializer::Serialize(aicore_args_format).GetString()); tasks.back() = aicore_task.Serialize(); return SUCCESS; }

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

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

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询