参数名 |
描述 |
---|---|
T |
ReduceMax/ReduceMin指令的数据类型,支持half/float。 |
参数名 |
输入/输出 |
描述 |
---|---|---|
maxMinValue |
输入 |
ReduceMax/ReduceMin指令的最大值/最小值。 |
maxMinIndex |
输入 |
ReduceMax/ReduceMin指令的最值对应的索引值。 |
ReduceMax/ReduceMin的连续场景下的最大/最小值以及相应的索引值。
Atlas推理系列产品AI Core,支持仅获取最值的接口,不支持获取最值和索引的接口。
Atlas A2训练系列产品/Atlas 800I A2推理产品,支持获取最值和索引的接口,不支持仅获取最值的接口。
1 2 3 4 5 | AscendC::LocalTensor<float> src; AscendC::LocalTensor<float> work; AscendC::LocalTensor<float> dst; int32_t mask = 64; AscendC::ReduceMax(dst, src, work, mask, 1, 8, true); // 连续场景,srcRepStride = 8,且calIndex = true |
1 2 3 4 5 6 7 | AscendC::LocalTensor<float> src; AscendC::LocalTensor<float> dst; int32_t mask = 64; AscendC::WholeReduceMax(dst, src, mask, 1, 1, 1, 8); float val = 0; // 最值 float idx = 0; // 最值的索引值,与ReduceMax的结果相同 AscendC::GetReduceMaxMinCount<float>(val, idx); |
1 2 3 4 5 6 7 | AscendC::LocalTensor<float> src; AscendC::LocalTensor<float> work; AscendC::LocalTensor<float> dst; int32_t mask = 64; AscendC::ReduceMax(dst, src, work, mask, 1, 8, true); float val = 0; // 最值 AscendC::GetReduceMaxMinCount<float>(val); |