Premium problem50. Positions of the Min and Max

Easy Locked

Return a length-2 tensor [i_min, i_max] holding the indices (not values) of the minimum and maximum elements of 1-D tensor x.

Input

tensor([5., 1., 9., 3.])

Output

tensor([1, 2])

Premium problem

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

Implement solve(...)