How to randomly set a fixed number of elements in each row of a tensor

Again, I am so grateful for your time and effort and sorry for any inconvenience I might have caused.

Best,
Sina

1 Like