Skip to content

[FEA] add argminmax function #691

@tylera-nvidia

Description

@tylera-nvidia

Is your feature request related to a problem? Please describe.
MatX currently only has a argmin and argmax function, requiring separate kernel launches for each. If a user needs both the min and max, we should be able to submit a single kernel to calculate both (really all 4 outputs).

Describe the solution you'd like

A single call returns minValue, minIdx, maxValue, and maxIdx, such as the call below:

(matx::mtie(minVal, minIdx, maxVal, maxIdx) = matx::argminmax(inFlattened)).run();

This should work for batched reductions as well( outputs are all some higher dimension tensor, matching the sizes of inFlattened).

Describe alternatives you've considered
We can currently compute these results with separate calls, but this is less performant.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions