You can try torch.nonzero(x) , or x.ne(0) (meaning 'not equal'). One of the two solutions will probably suit your needs.
確定! 回上一頁