管理中心

GetData

函数功能

获取Tensor的数据地址。

函数原型

收起
自动换行
深色代码主题
复制
  1. template<class T> const T *GetData() const
  2. template<class T> T *GetData()

参数说明

展开
参数 输入/输出 说明
T 输入 数据类型。

返回值

数据地址。

约束说明

无

调用示例

收起
自动换行
深色代码主题
复制
  1. Tensor tensor{{{8, 3, 224, 224}, {16, 3, 224, 224}}, // shape
  2. {ge::FORMAT_ND, ge::FORMAT_FRACTAL_NZ, {}}, // format
  3. kFollowing, // placement
  4. ge::DT_FLOAT16, // dt
  5. nullptr};
  6. auto addr = tensor.GetData<int64_t>();