FunctionRacerProblemsRace

The k Largest

EasyPyTorchPython

Return the k largest elements of the 1-D tensor x, the largest first.

Example 1

x [3.0,9.0,1.0,7.0]
k 2
returns [9.0,7.0]

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More PyTorch problems