MCPcopy Create free account
hub / github.com/dask/dask / topk_aggregate

Function topk_aggregate

dask/array/chunk.py:191–206  ·  view source on GitHub ↗

Final aggregation function of topk Invoke topk one final time and then sort the results internally.

(a, k, axis, keepdims)

Source from the content-addressed store, hash-verified

189
190
191def topk_aggregate(a, k, axis, keepdims):
192 """Final aggregation function of topk
193
194 Invoke topk one final time and then sort the results internally.
195 """
196 assert keepdims is True
197 a = topk(a, k, axis, keepdims)
198 axis = axis[0]
199 a = np.sort(a, axis=axis)
200 if k < 0:
201 return a
202 return a[
203 tuple(
204 slice(None, None, -1) if i == axis else slice(None) for i in range(a.ndim)
205 )
206 ]
207
208
209def argtopk_preprocess(a, idx):

Callers

nothing calls this directly

Calls 1

topkFunction · 0.70

Tested by

no test coverage detected