asc_get_reduce_max_cnt
产 品 支 持 情 况
| 产 品 | 是 否 支 持 |
|---|---|
| √ | |
| √ |
功 能 说 明
此 接 口 用 于 获 取 执 行asc_repeat_reduce_max操 作 后 的 最 大 值,以 及 第 一 个 最 大 值 时 的 索 引。
函 数 原 型
C++
__aicore__ inline void asc_get_reduce_max_cnt(half& val, uint32_t& index)
__aicore__ inline void asc_get_reduce_max_cnt(float& val, uint32_t& index)
参 数 说 明
| 参 数 名 | 输 入/输 出 | 描 述 |
|---|---|---|
| val | 输 出 | 最 大 值。 |
| index | 输 出 | 第 一 个 最 大 值 时 的 索 引。 |
返 回 值 说 明
无
流 水 类 型
PIPE_S
约 束 说 明
- 需 和asc_repeat_reduce_max操 作 配 合 使 用。
- 需 通 过 同 步 操 作 确 保asc_repeat_reduce_max执 行 完 成 后 再 调 用 本 接 口 获 取 结 果。
调 用 示 例
C++
// 示 例 计 算256个half的 最 大 值 和 索 引,分2次 迭 代 完 成,计 算 结 果 为2组value_index
constexpr uint32_t total_length = 256;
__ubuf__ half src[total_length];
constexpr uint32_t dst_length = 4;
__ubuf__ half dst[dst_length];
asc_repeat_reduce_max_value_index(dst, src, total_length);
asc_sync();
half maxValue;
uint32_t maxIndex;
asc_get_reduce_max_cnt(maxValue, maxIndex);
结 果 示 例:
Text
输 入 数 据src:[1, 2, 3, ..., 128, 129, ..., 256]
maxValue: 256.0
maxIndex: 255