Premium problem30. n Largest Values

Medium Locked

Return the n largest values of tensor Z, sorted ascending.

Input

Z = tensor([3, 1, 4, 1, 5, 9, 2, 6])
n = 3

Output

tensor([5, 6, 9])

Premium problem

This one's part of Premium. Unlock the full PyTorch track plus every other premium problem on the site.

Implement solve(...)