I have a tensor with positive and negative values, I would like to have a new tensor of the same size but only with positive values, whose distribution is the same as that of the positive values of the original tensor. In other words, the new tensor should be constructed by sampling only the positive values from the original tensor.

Something like that, but more “pythonic”:

```
oldact = copy.deepcopy(act)
for no in range(z.lrsize[lr]):
for si in range(BATCHSIZE):
getout = False
while getout == False:
xi = random.randrange(BATCHSIZE)
if oldact[no][xi] > 0:
act [no][si] = oldact[no][xi]
getout = True
```