Skip to content

GetLength

产品支持情况​

  • Ascend 950PR&950DT系列产品:支持
  • Atlas A3系列产品:支持
  • Atlas A2系列产品:支持
  • Atlas 200I/500 A2推理产品:支持
  • Atlas推理系列产品AI Core:支持
  • Atlas推理系列产品Vector Core:支持
  • Atlas训练系列产品:支持

功能说明​

获取LocalTensor数据长度。

函数原型​

C++
__aicore__ inline uint32_t GetLength() const

参数说明​

无

返回值说明​

LocalTensor数据长度,单位为字节。

约束说明​

无

调用示例​

C++
// 获取localTensor的长度(单位为Byte),数据类型为int32_t,所以是16*sizeof(int32_t)
uint32_t len = inputLocal.GetLength();
// inputLocal:0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
// len: 64

免责声明:本站内容由 asc-devkit 仓 master 分支自动编译生成,属于持续开发版本,可能存在缺陷,仅供预览与参考。如需稳定及商用资料,请查阅官方 昇腾社区。