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),仅供参考