跳到主要内容

GetShape

GetByteSize

函数功能

用于获取buffer字节数据量。

函数原型

size_t GetByteSize() const;

返回参数说明

数据结构说明
size_t返回具体数值。

父主题: TensorBase

SetShape

函数功能

设置TensorBase的形状。

函数原型

APP_ERROR SetShape(std::vector<uint32_t> shape);

参数说明

参数名输入/输出说明
shape输入shape向量中各维度要求为正整数且单个或各项乘积需小于536,870,912(512 * 1024 * 1024),否则函数将抛出异常。

返回参数说明

数据结构说明
APP_ERROR程序执行返回的错误码,请参考APP_ERROR说明

父主题: TensorBase

GetShape

函数功能

用于获取Tensor的形状。

函数原型

std::vector<uint32_t> GetShape() const;

返回参数说明

数据结构说明
std::vector<uint32_t>shape数组。

父主题: TensorBase

GetStrides

函数功能

用于获取Tensor的步长。

函数原型

std::vector<uint32_t> GetStrides() const;

返回参数说明

参数名说明
std::vector<uint32_t>Tensor的步长数组。

父主题: TensorBase

GetDeviceId

函数功能

用于获取Tensor的设备号。

函数原型

int32_t GetDeviceId() const;

返回参数说明

数据结构说明
tensor返回设备号,是一个int类型。

父主题: TensorBase

GetDataType

函数功能

用于获取内存中张量的数据类型。

函数原型

TensorDataType GetDataType() const;

返回参数说明

数据结构说明
TensorDataType请参考TensorDataType枚举说明。

父主题: TensorBase

在线提单