Skip to main content

~TensorShape

类说明

该类主要有TensorShape数据结构的构造方法和相关的功能接口。

父主题: TensorShape

TensorShape

函数功能

TensorShape构造函数,创建TensorShape()对象。

函数原型

TensorShape() = default;
TensorShape (std::vector<T> shape);

参数说明

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

父主题: TensorShape

~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

在线提单