TransDataTo5HD

功能说明

NCHW转换成NC1HWC0格式。如果是数据类型是float,int32_t,uint32_t, int16_t,unint16_t,half, 则C0=16, 如果数据类型是uint8_t,int8_t,则C0=32。

上图NCHW内存排布图中,w和h是一个block的宽和高。

定义原型

template <typename T>
void TransDataTo5HD(const LocalTensor<T>& dstLocalList[16], const LocalTensor<T>& srcLocalList[16], const TransDataTo5HDParams& transDataParams);

参数说明

表1 0级接口参数表

参数名称

输入/输出

含义

dstLocalList

输出

目的操作数地址序列,类型为LocalTensor。

Atlas 训练系列产品,支持的数据类型为:int8_t/uint8_t/int16_t/uint16_t/half/int32_t/uint32_t/float

Atlas推理系列产品AI Core,支持的数据类型为:int8_t/uint8_t/int16_t/uint16_t/half/int32_t/uint32_t/float

Atlas A2训练系列产品,支持的数据类型为:int8_t/uint8_t/int16_t/uint16_t/half/int32_t/uint32_t/float

srcLocalList

输入

源操作数地址序列,类型为LocalTensor,srcLocalList中的元素需要32B对齐。数据类型须与dstLocalList保持一致。

Atlas 训练系列产品,支持的数据类型为:int8_t/uint8_t/int16_t/uint16_t/half/int32_t/uint32_t/float

Atlas推理系列产品AI Core,支持的数据类型为:int8_t/uint8_t/int16_t/uint16_t/half/int32_t/uint32_t/float

Atlas A2训练系列产品,支持的数据类型为:int8_t/uint8_t/int16_t/uint16_t/half/int32_t/uint32_t/float

transDataParams

输入

控制TransdataTo5HD的数据结构。结构体内包含:读取和写入位置的控制参数,迭代次数,相邻迭代间的地址步长等参数。该数据结构的定义请参考下文表格。

TransDataTo5HD结构体内参数说明:

参数名称

类型

说明

dstHighHalf

输入

指定每个dstLocalList地址中的数据存储到 block 的高半部还是低半部,该配置只支持 int8_t /uint8_t 的数据类型。

支持的数据类型为 bool,有以下两种取值:
  • True:表示存储于 block 的高半部
  • False:表示存储于 block 的低半部

srcHighHalf

输入

指定每个srcLocalList地址中的数据从 block 的高半部还是低半部读取,该配置只支持int8_t/uint8_t的数据类型。

支持的数据类型为 bool,有以下两种取值:
  • True:表示存储于 block 的高半部
  • False:表示存储于 block 的低半部

repeatTimes

输入

重复迭代次数,repeatTimes∈[0,255]。

关于该参数的具体描述请参考重复迭代次数-Repeat times

注意事项:
  • 当 repeatTimes 为 1 时,目的操作数/源操作数的有效起始位置为 dstLocalList/srcLocalList 序列输入的起始位置加上 dstRepStride/srcRepStride;repeatTimes 为 1,如果要让目的操作数/源操作数的有效起始位置为 dstLocalList/srcLocalList 序列输入的起始位置,需要将dstRepStride/srcRepStride置为0。
  • 当 repeatTimes 大于 1 时,第一次 repeat 中目的操作数/源操作数的有效起始位置为 dstLocalList/srcLocalList 序列输入的起始位置,第二次需要加上 dstRepStride/srcRepStride。 以此类推。

dstRepStride

输入

相邻迭代间,目的操作数相同 block 地址 stride,单位:block。

相邻迭代间相同block的地址步长参数的详细说明请参考相邻迭代间相同block的地址步长

srcRepStride

输入

相邻迭代间,源操作数相同 block 地址 stride,单位:block。

相邻迭代间相同block的地址步长参数的详细说明请参考相邻迭代间相同block的地址步长

支持的型号

Atlas 训练系列产品

Atlas推理系列产品AI Core

Atlas A2训练系列产品

注意事项

返回值

调用示例