Here is another try, especially if you want to only use torch APIs. import torch def f(x): # non zero values mask non_zero_mask = x != 0 # ...
確定! 回上一頁