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

#### 产品支持情况

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


#### 功能说明

设置Tensor描述的placement属性，用于标识存放Tensor数据的内存为Host内存或Device内存。


#### 函数原型

- C函数原型
  1 aclError aclSetTensorPlaceMent(aclTensorDesc *desc, aclMemType memType)

- python函数
  1 ret = acl.set_tensor_place_ment(desc, mem_type)


#### 参数说明

| 参数名 | 说明 |
| --- | --- |
| desc | int，Tensor描述信息的指针地址。 需提前调用acl.create\_tensor\_desc接口创建算子输入/输出的Tensor描述，作为本接口的输入。 |
| mem\_type | int，指定placement属性值，其取值参考aclMemType(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/runtimeapi/aclpythondevg\_01\_0940.html)。 |


#### 返回值说明

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