GetData
operator =
函数功能
Tensor类重载等号运算符,对成员变量进行深拷贝,对内存数据进行浅拷贝,引用计数加一。
函数原型
Tensor &operator=(const Tensor &other)
参数说明
| 参数名 | 输入/输出 | 说明 |
|---|---|---|
| other | 输入 | 输入的Tensor类。 |
父主题: Tensor
operator ==
operator ==
函数功能
Tensor类重载相等运算符,检查两个Tensor的内容是否相等。
函数原型
bool operator==(const Tensor &other);
参数说明
| 参数名 | 输入/输出 | 说明 |
|---|---|---|
| other | 输入 | 输入的Tensor类。 |
父主题: Tensor
GetData
函数功能
获得Tensor的内存数据。
函数原型
void* GetData() const
返回参数说明
| 数据结构 | 说明 |
|---|---|
| void* | Tensor数据裸指针。 |
父主题: Tensor
SetShape
函数功能
设置Tensor的形状(Shape)。
函数原型
APP_ERROR SetShape(std::vector<uint32_t> shape);
参数说明
| 参数名 | 输入/输出 | 说明 |
|---|---|---|
| shape | 输入 | Tensor的形状。 shape所代表的元素个数需要与Tensor的原shape所代表的元素个数相同。shape向量中各维度要求为正整数且单个或各项乘积需小于536,870,912(512 * 1024 * 1024),否则函数将抛出异常。 |
返回参数说明
| 数据结构 | 说明 |
|---|---|
| APP_ERROR | 程序执行返回的错误码,请参考APP_ERROR说明。 |
父主题: Tensor
GetShape
函数功能
获得Tensor的shape数据。
函数原型
std::vector<uint32_t> GetShape() const
返回参数说明
| 数据结构 | 说明 |
|---|---|
| std::vector<uint32_t> | Tensor的shape数据。 |
父主题: Tensor
GetDataType
函数功能
获得Tensor的数据类型。
函数原型
MxBase::TensorDType GetDataType() const
返回参数说明
| 数据结构 | 说明 |
|---|---|
| MxBase::TensorDType | Tensor的数据类型,请参见TensorDType。 |
父主题: Tensor
在线提单