函数:create_tensor_desc
产品支持情况
产品  | 
是否支持  | 
|---|---|
√  | 
|
√  | 
|
√  | 
|
√  | 
|
√  | 
|
√  | 
使用说明
C函数原型  | 
aclTensorDesc *aclCreateTensorDesc(aclDataType dataType, int numDims, const int64_t *dims, aclFormat format)  | 
|---|---|
Python函数  | 
tensor_desc = acl.create_tensor_desc(data_type, dims, format)  | 
函数功能  | 
创建aclTensorDesc类型的数据,该数据类型用于描述Tensor的数据类型、Shape、Format等信息。 如需销毁aclTensorDesc类型的数据,请参见函数:destroy_tensor_desc。  | 
输入说明  | 
data_type:int,表述Tensor描述的数据类型。 dims:list,Tensor描述指定维度大小。“dims”是一个int的列表,列表中的每项表示Tensor中每个维度的大小,如果列表中某个元素的值为0,则为空Tensor。如果用户需要使用空Tensor,则在申请内存时,内存大小最小为1Byte,以保障后续业务正常运行。 format:int,Tensor描述的Format。  | 
返回值说明  | 
tensor_desc:int,创建Tensor描述的地址对象。  | 
约束说明  | 
无  | 
父主题: aclmdlTensorDesc