apeforest commented on a change in pull request #15948: Fix a memory
misalignment in topk operator
URL: https://github.com/apache/incubator-mxnet/pull/15948#discussion_r316402119
##########
File path: src/operator/tensor/ordering_op-inl.h
##########
@@ -414,30 +414,28 @@ void TopKImpl(const RunContext &ctx,
<< element_num << ", but the selected index_t can only represent "
<< mxnet::common::MaxIntegerValue<index_t>() << " elements";
Tensor<xpu, 3, DType> dat = src.FlatTo3D<xpu, DType>(axis, axis, s);
- size_t temp_size = 0;
- // Temp space needed by the gpu-based full sorts.
- temp_size = std::max(temp_size,
- mxnet::op::SortByKeyWorkspaceSize<int, int, xpu>(src.Size()));
- temp_size = std::max(temp_size,
- mxnet::op::SortByKeyWorkspaceSize<int, DType, xpu>(src.Size()));
- temp_size = std::max(temp_size,
- mxnet::op::SortByKeyWorkspaceSize<DType, int, xpu>(src.Size()));
+ // Temp space needed by the full sorts.
+ size_t temp_size = std::max(
+ mxnet::op::SortByKeyWorkspaceSize<index_t, DType, xpu>(src.Size()),
+ mxnet::op::SortByKeyWorkspaceSize<DType, index_t, xpu>(src.Size()));
Review comment:
Done
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services