跳到主要内容

SetShape

~TensorShape

函数功能

TensorShape类的默认析构函数。

函数原型

~TensorShape() = default;

父主题: TensorShape

GetDims

函数功能

获取Tensor形状的维度。

函数原型

uint32_t GetDims() const;

返回参数说明

数据结构说明
uint32_tTensor形状的维度值。

父主题: TensorShape

SetShape

函数功能

设置Tensor的形状。

函数原型

template<typename T>
void SetShape(std::vector<T> shape);

参数说明

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

父主题: TensorShape

GetShape

函数功能

获取Tensor的具体形状。

函数原型

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

返回参数说明

数据结构说明
std::vector<uint32_t>Tensor的形状。

父主题: TensorShape

GetSize

函数功能

获取Tensor的大小。

函数原型

uint32_t GetSize() const;

返回参数说明

数据结构说明
uint32_tTensor的大小。

父主题: TensorShape

operator[]

函数功能

获取Tensor指定索引维度的大小。

函数原型

size_t operator[] (uint32_t idx) const;
size_t &operator[] (uint32_t idx);

参数说明

参数名输入/输出说明
uint32_t输入Tensor维度索引值。

返回参数说明

数据结构说明
size_tTensor指定维度的大小。

父主题: TensorShape

在线提单