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