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

#### 产品支持情况

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


#### 功能说明

调用acl.create_tensor_desc接口创建Tensor描述信息后，可通过acl.set_tensor_storage_shape设置Tensor的实际“dims”信息，当前主要用于PyTorch场景下。

此接口后续版本会废弃，请使用acl.set_tensor_shape接口。


#### 函数原型

- C函数原型
  1 aclError aclSetTensorStorageShape(aclTensorDesc *desc, int numDims, const int64_t *dims)

- python函数
  1 ret = acl.set_tensor_storage_shape(desc, dims)


#### 参数说明

| 参数名 | 说明 |
| --- | --- |
| desc | int，aclTensorDesc类型的指针地址。 需提前调用acl.create\_tensor\_desc接口创建aclTensorDesc类型。 |
| dims | list，要设置的“dims”维度数。 |


#### 返回值说明

| 返回值 | 说明 |
| --- | --- |
| ret | int，错误码。 返回0表示成功。 返回其它值(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/runtimeapi/aclpythondevg\_01\_0911.html)表示失败。 |
