So I decided to choose using argwhere to avoid confusions of using other methods. They are quite similar for actual purpose.
arr = np.array([1, 2, 3, 4, 5])
indices_w = np.where(arr > 2)
indices_aw = np.argwhere(arr > 2)
indices_nz = np.nonzero(arr > 2)
indices_w, indices_aw, indices_nz
# output
((array([2, 3, 4]),),
array([[2],
[3],
[4]]),
(array([2, 3, 4]),))
import torch
arr = torch.tensor([1, 2, 3, 4, 5])
indices_w = torch.where(arr > 2)
indices_aw = torch.argwhere(arr > 2)
indices_nz = torch.nonzero(arr > 2)
indices_w, indices_aw, indices_nz
# outputs
((tensor([2, 3, 4]),),
tensor([[2],
[3],
[4]]),
tensor([[2],
[3],
[4]]))