---
title: 函数：get_dynamic_hw
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/ascendgraphapi/aclpythondevg_01_0213.html
sourcePath: /source/zh/canncommercial/900/API/ascendgraphapi/aclpythondevg_01_0213.html
indexId: 41aba24d2f4f95bd4324451f67076938beece755bf000a509996d5398b2f086a75
---
# 函数：get_dynamic_hw

#### 产品支持情况

| 产品 | 是否支持 |
| --- | --- |
| Atlas 350 加速卡 | √ |
| Atlas A3 训练系列产品 / Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | √ |
| Atlas 训练系列产品 | √ |
| Atlas 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | √ |


#### 功能说明

根据模型描述信息获取模型支持的动态宽高信息。


#### 函数原型

- C函数原型
  1 aclError aclmdlGetDynamicHW(const aclmdlDesc *modelDesc, size_t index, aclmdlHW *hw)

- python函数
  1 hw_info, ret = acl.mdl.get_dynamic_hw(model_desc, index)


#### 参数说明

| 参数名 | 说明 |
| --- | --- |
| model\_desc | int，aclmdlDesc类型数据的指针地址。 需提前调用acl.mdl.create\_desc接口创建aclmdlDesc类型的数据。 |
| index | int，预留参数，当前未使用，固定设置为\-1。 |


#### 返回值说明

| 返回值 | 说明 |
| --- | --- |
| hw\_info | dict，获取的模型支持的宽高信息。 最大的HW数量为128。 hw\_info = { "hwCount": int，\#模型中支持的宽高分档数 "hw":[xx, xx,] \# 模型中支持的具体分档，每组分档中，数组下标为0代表的是高，下标为1代表的是宽 } “hwCount”等于0时，表示不支持设置档位信息，以模型中的档位为准。 |
| ret | int，错误码。 返回0表示成功。 返回其它值(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/runtimeapi/aclpythondevg\_01\_0911.html)表示失败。 |
