diff --git a/src/operator/numpy/np_broadcast_reduce_op.h b/src/operator/numpy/np_broadcast_reduce_op.h index ac1d1611dcff..c475622c49c3 100644 --- a/src/operator/numpy/np_broadcast_reduce_op.h +++ b/src/operator/numpy/np_broadcast_reduce_op.h @@ -916,7 +916,7 @@ void NumpyMedianForward(const nnvm::NodeAttrs& attrs, Stream *s = ctx.get_stream(); - auto ¶m = nnvm::get(attrs.parsed); + NumpyMedianParam param = nnvm::get(attrs.parsed); const TBlob& a = inputs[0]; const TBlob& r = outputs[0]; @@ -979,6 +979,12 @@ void NumpyMedianForward(const nnvm::NodeAttrs& attrs, t_shape_ex[i] = a.shape_[axes[i-small.ndim()]]; } + TopKParam topk_param; + topk_param.axis = dmlc::optional(-1); + topk_param.is_ascend = true; + topk_param.k = 0; + topk_param.ret_typ = topk_enum::kReturnValue; + MSHADOW_TYPE_SWITCH(a.type_flag_, DType, { using namespace mshadow::expr; Tensor workspace; @@ -1033,12 +1039,6 @@ void NumpyMedianForward(const nnvm::NodeAttrs& attrs, TransposeImpl(ctx.run_ctx, a, a_trans, t_axes); - TopKParam topk_param; - topk_param.axis = dmlc::optional(-1); - topk_param.is_ascend = true; - topk_param.k = 0; - topk_param.ret_typ = topk_enum::kReturnValue; - TBlob a_sort = TBlob(sort_ptr, t_shape, xpu::kDevMask); TBlob a_idx = TBlob(idx_ptr, t_shape, xpu::kDevMask);