GetTensorData
函数功能
获取Tensor中的数据,返回只读的TensorData类型对象。
函数原型
1 | const TensorData &GetTensorData() const |
参数说明
无
约束说明
无
调用示例
1 2 3 4 5 | StorageShape sh({1, 2, 3}, {1, 2, 3}); TensorV2 t = {sh, {ge::FORMAT_ND, ge::FORMAT_FRACTAL_NZ, {}}, kOnHost, ge::DT_FLOAT, nullptr}; auto a = reinterpret_cast<void *>(10); t.MutableTensorData() = TensorData{a, nullptr}; // 设置新tensordata auto addr = t.GetTensorData().GetAddr(); // 10 |
父主题: TensorV2