Paddle icon indicating copy to clipboard operation
Paddle copied to clipboard

Bugfix/unique consecutive

Open LCStayingdullCircuit opened this issue 6 months ago • 3 comments
trafficstars

PR Category

Operator Mechanism

PR Types

Bug fixes

Description

修复了 paddle.unique_consecutive 大 Tensor 下的报错问题。

  • 算子简介 paddle.unique_consecutive 主要功能是去除张量中的连续重复元素,同时可以根据传入的 flag 值返回不同的元组。

  • 修改点 问题定位在 unique_consecutive_functor.h 中的以下代码段。怀疑是 auto 自动判定类型导致溢出,修改为 int64_t 后可以成功编译:

    for (auto i = 0; i < outer_nums; i++) {
      auto input_start_offset = i * input_width;
      auto output_start_offset = i * output_width;
    
      for (auto j = 0; j < index_size; j++) {
        IndexT index_value = index_vec[j];
        if (index_value < 0) {
          index_value += input_dim[dim];
        }
        for (auto k = 0; k < slice_size; k++) {
          out_vec[output_start_offset + j * slice_size + k] =
              input_vec[input_start_offset + index_value * slice_size + k];
        }
      }
    }
    
  • 性能变化 性能下降了 2% 左右。

LCStayingdullCircuit avatar May 22 '25 02:05 LCStayingdullCircuit

你的PR提交成功,感谢你对开源项目的贡献! 请关注后续CI自动化测试结果,详情请参考Paddle-CI手册。 Your PR has been submitted. Thanks for your contribution! Please wait for the result of CI firstly. See Paddle CI Manual for details.

paddle-bot[bot] avatar May 22 '25 02:05 paddle-bot[bot]

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar May 22 '25 02:05 CLAassistant

/re-run all-failed

LCStayingdullCircuit avatar May 23 '25 10:05 LCStayingdullCircuit

Sorry to inform you that a7504f8's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

paddle-ci-bot[bot] avatar Jun 24 '25 02:06 paddle-ci-bot[bot]