Paddle
Paddle copied to clipboard
Bugfix/unique consecutive
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% 左右。
你的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.
/re-run all-failed
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.