未验证 提交 29453da1 编写于 作者: Z Zhang Zheng 提交者: GitHub

Fix bug when eigen_device() is nullptr in top_k (#40459)

上级 88ec08a7
...@@ -78,8 +78,9 @@ void TopkKernel(const Context& dev_ctx, ...@@ -78,8 +78,9 @@ void TopkKernel(const Context& dev_ctx,
// The conclusion is drawn from the data through multiple sets of // The conclusion is drawn from the data through multiple sets of
// statistics // statistics
if (input_width >= 128 && k >= input_width * 0.75) { if (input_width >= 128 && k >= input_width * 0.75) {
if (ops::SortTopk<T>( auto* ctx = reinterpret_cast<const paddle::platform::CUDADeviceContext*>(
paddle::platform::CUDADeviceContext(dev_ctx.GetPlace()), &dev_ctx);
if (ops::SortTopk<T>(*ctx,
input, input,
input_width, input_width,
input_height, input_height,
...@@ -181,8 +182,9 @@ void TopkKernel(const Context& dev_ctx, ...@@ -181,8 +182,9 @@ void TopkKernel(const Context& dev_ctx,
// The conclusion is drawn from the data through multiple sets of // The conclusion is drawn from the data through multiple sets of
// statistics // statistics
if (input_width >= 128 && k >= input_width * 0.75) { if (input_width >= 128 && k >= input_width * 0.75) {
if (ops::SortTopk<T>( auto* ctx = reinterpret_cast<const paddle::platform::CUDADeviceContext*>(
paddle::platform::CUDADeviceContext(dev_ctx.GetPlace()), &dev_ctx);
if (ops::SortTopk<T>(*ctx,
&trans_input, &trans_input,
input_width, input_width,
input_height, input_height,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册