跳到主要内容

函数:create_tensor_desc

函数:get_data_buffer_size_v2

C函数原型size_t aclGetDataBufferSizeV2(const aclDataBuffer *dataBuffer)
Python函数size = acl.get_data_buffer_size_v2(data_buffer)
函数功能获取aclDataBuffer类型中数据的内存大小,单位Byte。
输入说明data_buffer:int,aclDataBuffer的指针地址。
返回值说明size:int,aclDataBuffer类型中数据的内存大小。
约束说明

父主题: 公共接口

函数:update_data_buffer

C函数原型aclError aclUpdateDataBuffer(aclDataBuffer *dataBuffer, void *data, size_t size)
Python函数ret = acl.update_data_buffer(data_buffer, data, size)
函数功能更新aclDataBuffer中数据的内存及大小。同步接口。 更新aclDataBuffer后,之前aclDataBuffer中存放数据的内存如果不使用,需及时释放,否则可能会导致内存泄漏。
输入说明data_buffer:int,aclDataBuffer类型的指针地址。 需提前调用acl.create_data_buffer接口创建aclDataBuffer类型的数据。 该内存需由用户自行管理,调用acl.rt.malloc接口/acl.rt.free接口申请/释放内存,或调用acl.rt.malloc_host接口/acl.rt.free_host接口申请/释放内存。 data:int,存放数据内存地址的指针地址。 size:int,内存大小,单位Byte。如果用户需要使用空Tensor,则在申请内存时,内存大小最小为1Byte。
返回值说明ret:int,错误码。
- 返回0表示成功。
- 返回其它值表示失败。
约束说明

父主题: 公共接口

函数:data_type_size

C函数原型size_t aclDataTypeSize(aclDataType dataType)
Python函数size = acl.data_type_size(data_type)
函数功能获取aclDataType数据的大小,单位Byte,同步接口。
输入说明data_type:int,指定要获取大小的aclDataType数据。
返回值说明size:int,aclDataType数据的大小,单位Byte。
约束说明

父主题: 公共接口

函数: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:int list,Tensor描述指定维度大小。“dims”是一个int的list,列表中的每项表示Tensor中每个维度的大小,如果列表中某个元素的值为0,则为空Tensor。如果用户需要使用空Tensor,则在申请内存时,内存大小最小为1Byte,以保障后续业务正常运行。 format:int,Tensor描述的Format。
返回值说明tensor_desc:int,创建Tensor描述的地址对象。
约束说明

父主题: 公共接口

函数:destroy_tensor_desc

C函数原型void aclDestroyTensorDesc(const aclTensorDesc *desc)
Python函数acl.destroy_tensor_desc(desc)
函数功能销毁aclTensorDesc类型的数据,同步接口。
输入说明desc:int,待销毁的aclTensorDesc类型的指针地址。
返回值说明
约束说明

父主题: 公共接口

函数:get_tensor_desc_type

C函数原型aclDataType aclGetTensorDescType(const aclTensorDesc *desc)
Python函数type = acl.get_tensor_desc_type(desc)
函数功能获取Tensor描述中的数据类型,同步接口。
输入说明desc:int,aclTensorDesc类型的指针地址。 需提前调用acl.create_tensor_desc接口创建aclTensorDesc类型。
返回值说明Type:int,返回指定Tensor描述的数据类型。
约束说明

父主题: 公共接口

函数:get_tensor_desc_format

C函数原型aclFormat aclGetTensorDescFormat(const aclTensorDesc *desc)
Python函数format = acl.get_tensor_desc_format(desc)
函数功能获取Tensor描述中的Format,同步接口。
输入说明desc:int,aclTensorDesc类型的指针地址。 需提前调用acl.create_tensor_desc接口创建aclTensorDesc类型。
返回值说明format:int, 返回指定Tensor描述的格式。
约束说明

父主题: 公共接口

在线提单