Hi All,
I am struggling with sampling problem.
I want to sample only some values in matrix.
I would like to sample in a masked matrix.
For example, There is a 10x10 matrix like below.
[[0.894 0.107 0.94  0.801 0.793 0.992 0.437 0.    0.    0.   ]
[0.444 0.956 0.002 0 0.043 0.504 0.904 0.    0.    0.   ]
[0.978 0.22  0 0.918 0.342 0.168 0.927 0.    0.    0.   ]
[0.334 0.166 0.094 0.853 0.619 0.58  0.745 0.    0.    0.   ]
[0.021 0  0.23  0.232 0.339 0.794 0.351 0.    0.    0.   ]
[0.758 0.566 0.01  0.141 0.306 0.766 0.757 0.    0.    0.   ]
[0.71  0 0 0.738 0.6   0.154 0.917 0.    0.    0.   ]
[0.757 0.573 0.324 0.04  0.075 0.216 0.872 0.    0.    0.   ]
[0.    0.    0.    0.    0.    0.    0.    0.    0.    0.   ]
[0.    0.    0.    0.    0.    0.    0.    0.    0.    0.   ]]
It is not necessarily zero.
I want to sample only in non-masking parts.
I want to do sample for each row. Ex) torch.multinomial
Please give me some tips for this task.
Thanks.