BilinearInterpolation
功能说明
功能分为水平迭代和垂直迭代。每个水平迭代顺序地从src0Offset读取8个偏移值,表示src0 的偏移,每个偏移值指向src0的一个block的起始地址,如果repeatMode=false,从src1中取一个值,与src0中8个block中每个值进行乘操作;如果repeatMode=true,从src1中取8个值,按顺序与src0中8个block中的值进行乘操作,最后当前迭代的dst结果与前一个dst结果按block进行累加,存入目的地址,在同一个水平迭代内dst地址不变。然后进行垂直迭代,垂直迭代的dst起始地址为上一轮垂直迭代的dst起始地址加上vOffset,本轮垂直迭占用dst空间为dst起始地址之后的8个block,每轮垂直迭代进行hRepeat次水平迭代。

函数原型
- mask逐bit模式: 
      1 2 template <typename T> __aicore__ inline void BilinearInterpolation(const LocalTensor<T> &dstLocal, const LocalTensor<T> &src0Local, const LocalTensor<uint32_t> &src0OffsetLocal, const LocalTensor<T> &src1Local, uint64_t mask, uint8_t hRepeat, bool repeatMode, uint16_t dstBlkStride, uint16_t vROffset, uint8_t vRepeat, const LocalTensor<uint8_t> &sharedTmpBuffer) 
- mask连续模式: 
      1 2 template <typename T> __aicore__ inline void BilinearInterpolation(const LocalTensor<T> &dstLocal, const LocalTensor<T> &src0Local, const LocalTensor<uint32_t> &src0OffsetLocal, const LocalTensor<T> &src1Local, uint64_t mask[], uint8_t hRepeat, bool repeatMode, uint16_t dstBlkStride, uint16_t vROffset, uint8_t vRepeat, const LocalTensor<uint8_t> &sharedTmpBuffer) 
参数说明
| 参数名 | 输入/输出 | 描述 | 
|---|---|---|
| dstLocal | 输出 | 目的操作数。 类型为LocalTensor,支持的TPosition为VECIN/VECCALC/VECOUT。 LocalTensor的起始地址需要32字节对齐。 Atlas A2训练系列产品/Atlas 800I A2推理产品,支持的数据类型为:half Atlas推理系列产品AI Core,支持的数据类型为:half | 
| src0Local、src1Local | 输入 | 源操作数。 类型为LocalTensor,支持的TPosition为VECIN/VECCALC/VECOUT。 LocalTensor的起始地址需要32字节对齐。 两个源操作数的数据类型需要与目的操作数保持一致。 Atlas A2训练系列产品/Atlas 800I A2推理产品,支持的数据类型为:half Atlas推理系列产品AI Core,支持的数据类型为:half | 
| src0OffsetLocal | 输入 | 源操作数。 类型为LocalTensor,支持的TPosition为VECIN/VECCALC/VECOUT。 LocalTensor的起始地址需要32字节对齐。 Atlas A2训练系列产品/Atlas 800I A2推理产品,支持的数据类型为:uint32_t Atlas推理系列产品AI Core,支持的数据类型为:uint32_t | 
| mask | 输入 | 
 | 
| hRepeat | 输入 | 水平方向迭代次数,取值范围为[1, 255]。 | 
| repeatMode | 输入 | 迭代模式,数据类型为立即数,取值范围[0, 1],支持的数据类型为立即数(int)。 
 | 
| dstBlkStride | 输入 | 单次迭代内,目的操作数不同block间地址步长,以32B为单位。 | 
| vROffset | 输入 | 垂直迭代间,目的操作数地址偏移量,以element为单位,取值范围为[128, 65535]。 | 
| vRepeat | 输入 | 垂直方向迭代次数,取值范围为[1, 255]。 | 
| sharedTmpBuffer | 输入 | 临时空间。 Atlas A2训练系列产品/Atlas 800I A2推理产品,需要保证至少分配了src0Local.GetSize() * 32 + src1Local.GetSize() * 32字节的空间。 Atlas推理系列产品AI Core,需要保证至少分配了src0OffsetLocal.GetSize() * sizeof(uint32_t)字节的空间。 | 
返回值
无
支持的型号
Atlas A2训练系列产品/Atlas 800I A2推理产品
Atlas推理系列产品AI Core
调用示例
- 接口样例-mask连续模式 
      1 2 3 4 5 6 7 8 9 10 11 12 AscendC::LocalTensor<half> dstLocal, src0Local, src1Local; AscendC::LocalTensor<uint32_t> src0OffsetLocal; AscendC::LocalTensor<uint8_t> tmpLocal; uint64_t mask = 128; // mask连续模式 uint8_t hRepeat = 2; // 水平迭代2次 bool repeatMode = false; // 迭代模式 uint16_t dstBlkStride = 1; // 单次迭代内数据连续写入 uint16_t vROffset = 128; // 相邻迭代间数据连续写入 uint8_t vRepeat = 2; // 垂直迭代2次 AscendC::BilinearInterpolation(dstLocal, src0Local, src0OffsetLocal, src1Local, mask, hRepeat, repeatMode, dstBlkStride, vROffset, vRepeat, tmpLocal); 
- 接口样例-mask逐bit模式 
      1 2 3 4 5 6 7 8 9 10 11 12 AscendC::LocalTensor<half> dstLocal, src0Local, src1Local; AscendC::LocalTensor<uint32_t> src0OffsetLocal; AscendC::LocalTensor<uint8_t> tmpLocal; uint64_t mask[2] = { UINT64_MAX, UINT64_MAX }; // mask逐bit模式 uint8_t hRepeat = 2; // 水平迭代2次 bool repeatMode = false; // 迭代模式 uint16_t dstBlkStride = 1; // 单次迭代内数据连续写入 uint16_t vROffset = 128; // 相邻迭代间数据连续写入 uint8_t vRepeat = 2; // 垂直迭代2次 AscendC::BilinearInterpolation(dstLocal, src0Local, src0OffsetLocal, src1Local, mask, hRepeat, repeatMode, dstBlkStride, vROffset, vRepeat, tmpLocal); 
输入数据(src0Local,half): [1,2,3,...,512] 输入数据(src1Local,half): [2,3,4,...,17] 输入数据(src0OffsetLocal,uint32_t): [0,32,64,...,992] 输出数据(dstLocal,half): [389, 394, 399, 404, ...,4096]