新闻详情

新闻详情

首页 / 资讯中心 / 详情

CANN/ge ATC形状配置指南

发布时间:2026/10/25 19:01:47来源:尧图网络
CANN/ge ATC形状配置指南
ATC Model Conversion Practice Guide: Static Shape, Dynamic Multi-Gear, and Dynamic Shape【免费下载链接】geGEGraph Engine是面向昇腾的图编译器和执行器提供了计算图优化、多流并行、内存复用和模型下沉等技术手段加速模型执行效率减少模型内存占用。 GE 提供对 PyTorch、TensorFlow 前端的友好接入能力并同时支持 onnx、pb 等主流模型格式的解析与编译。项目地址: https://gitcode.com/cann/ge1 IntroductionThis document is intended for application developers and focuses on two core questions:Will the input size changeCan changes be enumerated in advanceBased on these two dimensions, practical solutions for usingATCto convert models in Ascend inference scenarios are provided. This document does not distinguish between frontend frameworks and applies to all model formats supported by ATC (such as ONNX, TensorFlow PB, Caffe, etc.).In Ascend inference scenarios, the choice of shape directly affects the compiler optimization level, runtime scheduling method, and final performance stability. Properly choosing between static shape, dynamic multi-gear, or dynamic shape, combined with ATCs capability characteristics, is key to achieving stable throughput and low latency.This document assumes that readers already understand the complete process of model conversion via ATC and model loading/inference usingaclmdlinterfaces.2 Overall Flow of Model Conversion and ExecutionBefore diving into specific strategies, lets unify the basic concepts of ATC and model execution phases from an overall flow perspective.Users convert models into.om(Offline Model) files viaATCcommand, then load and execute these models viaaclmdlseries interfaces. From GE (Graph Engine) perspective, these two phases are calledcompileandexecuterespectively.Compile PhaseGE reads the model file specified in ATC (such as ONNX or PB), analyzes and optimizes the computation graph, and generates a binary model file (.om) that can be executed on NPU.Execute PhaseGE loads the.omfile via aclmdl interfaces, deploys it to NPU device, and executes subsequent inference tasks.It should be clarified that GE adopts aclear separation of compile-time and runtime responsibilitiesmodel:The compile phase takes longer but usually needs to be executed only once to generate.om;The execute phase no longer performs structural graph optimization, inference overhead is small, and.omcan be repeatedly executed after loading.This characteristic determines theimportance of shape information at compile time.3 Static Shape, Dynamic Shape, and Performance CharacteristicsStatic ShapeStatic shapemeans that during multiple executions of the model, all tensor (input, output, and intermediate tensors) dimensions are completely fixed, and no dimension is allowed to change.In this mode, the compile phase can perform the most comprehensive optimizations and enablesink schedulingduring execution. The specific mechanism of sink scheduling can be found in the official documentation: https://www.hiascend.com/developer/techArticles/20240715-1In engineering practice, static shape usually achieves the best inference performance and stability.Dynamic ShapeDynamic shapemeans that during multiple executions of the model, the dimensions of input or intermediate tensors may change.Its advantage is flexibility, but the cost is also obvious:Significantly fewer optimizations available at compile time;Cannot enable sink scheduling;Inference performance and latency stability are usually poor.Therefore, in performance-sensitive inference scenarios, completely dynamic shape should be avoided.Dynamic Multi-Gear (Recommended Balanced Solution)Considering the significant performance advantage brought by static shape, ATC providesdynamic multi-gearcapability to handlescenarios where shape changes are limited and enumerable.The essence of dynamic multi-gear is: During model conversion phase,specify multiple fixed static shape gears at once. At runtime, select the matching gear to execute based on actual input, but each gear is treated as static shape during compile phase.For example, if only the batch dimension of the model is variable and may take the following values:[1, 3, 224, 224][8, 3, 224, 224][16, 3, 224, 224]Then these three batch sizes can be passed to ATC simultaneously as three gears.After enabling dynamic multi-gear:The model still appears as dynamic at execution level;The compiler can perform static shape optimization for each gear;Inference performance usually matches that of single static shape.Note that while dynamic multi-gear brings performance benefits, it also introduces additional costs:Model memory occupation is based on the largest gearEven when executing the smallest gear, the overall model memory occupation is equivalent to the largest gear. For example, if the largest batch gear is 1024, even when executing batch1, memory occupation is still calculated as 1024.Compile time increases linearly with the number of gearsGenerally, the compile time for N gears is approximately N times that of single static shape.4 Overview of Shape-Related Parameter Configuration in ATCThis chapter explains from theATC parameter configuration perspectivehow the three strategies of static shape, completely dynamic shape, and dynamic multi-gear are expressed in ATC.Parameter Configuration for Static ShapeUnder the static shape strategy, the model needs tocompletely determine all input tensor dimensionsduring compile phase. When converting with ATC, users need to explicitly specify a fixed shape for each input.For example:【免费下载链接】geGEGraph Engine是面向昇腾的图编译器和执行器提供了计算图优化、多流并行、内存复用和模型下沉等技术手段加速模型执行效率减少模型内存占用。 GE 提供对 PyTorch、TensorFlow 前端的友好接入能力并同时支持 onnx、pb 等主流模型格式的解析与编译。项目地址: https://gitcode.com/cann/ge创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考
网站建设高端定制企业官网
RELATED

相关资讯

更多精彩内容,欢迎继续阅读

较早相关资讯

最新相关资讯

【外设】之大彩串口显示屏 2026/10/25 3:20:41

【外设】之大彩串口显示屏

大彩串口屏初步使用 1 .官网下载 STM32 屏幕 GUI 设计资料 http://www.gz-dc.com/category/typeid/4112 找到 STM32 Keil 工程,移植相关代码因项目而异进行移植,由于项目简单,本人只对用到的指令接口进行修改。 比如:注意事项&…

阅读更多 →
无法下载Windows系统iso文件 2026/10/25 3:43:49

无法下载Windows系统iso文件

当我遇到这个问题的时候,我打开了一个网站: 登录 然后我打算下载的时候: 突然那个官方的连接就可以下载了:

阅读更多 →
【清华代码熊】DeepSeek V4.1 Flash 后训练详解 2026/10/25 4:02:17

【清华代码熊】DeepSeek V4.1 Flash 后训练详解

📌 上期解析了 DeepSeek V4.1 Flash 模型架构改进,本期解析 DeepSeek V4.1 Flash 预训练/后训练技术: 🌟 预训练:45T 文本 多模态混合语料、直接训练 sparse attention(取消 DeepSeek V4 的 dense 冷启动&…

阅读更多 →
Shuffle-R1: Efficient RL framework for Multimodal Large Language Models via Data-centric Dynamic ... 2026/10/25 5:03:13

Shuffle-R1: Efficient RL framework for Multimodal Large Language Models via Data-centric Dynamic ...

文章主要内容和创新点 主要内容 本文聚焦于多模态大语言模型(MLLM)强化学习(RL)训练中的效率问题,提出了一个名为Shuffle-R1的框架。研究发现,当前RL训练存在两个关键缺陷: 优势值坍缩(Advantage Collapsing):批次中大多数优势值集中在零附近,导致有效梯度信号被淹…

阅读更多 →
PRvL: Quantifying the Capabilities and Risks of Large Language Models for PII Redaction 2026/10/25 3:54:32

PRvL: Quantifying the Capabilities and Risks of Large Language Models for PII Redaction

一、文章主要内容总结 本文聚焦于利用大型语言模型(LLMs)实现个人身份信息(PII)脱敏的研究,旨在解决传统脱敏方法(如基于规则的系统、领域特定命名实体识别(NER)模型)泛化能力差、跨格式/跨语境适应性弱的问题。 研究通过全面评估多种LLM架构(包括密集型LLM(D-LLM…

阅读更多 →
LLaVA-RE: Binary Image-Text Relevancy Evaluation with Multimodal Large Language Model 2026/10/25 5:32:24

LLaVA-RE: Binary Image-Text Relevancy Evaluation with Multimodal Large Language Model

文章主要内容和创新点 主要内容 本文聚焦于二进制图像-文本相关性评估任务(判断图像与文本“相关”或“不相关”),针对该任务中文本格式多样、相关性定义随场景变化等挑战,提出了基于多模态大语言模型(MLLM)的解决方案LLaVA-RE。 模型设计:LLaVA-RE基于LLaVA 1.5架构,…

阅读更多 →

今日资讯

本周资讯

本月资讯

看完文章仍有疑问?

联系尧图顾问,获取一对一建站咨询

立即免费咨询 📞 400-888-8888
📞 ✉