Closed arendsee closed 8 months ago
Thank you for opening this issue. You are right, there is a 1-p
which shouldn't be. I will fix it right away.
You could also just change the documentation. I'm using randsel
to "fuzz" a vector. For example, randsel(red_color, random(1, d), p=0.1)
, randomly moves 1/10 of the bits in red_color
, making a "reddish" value. As it stands,p
is a measure of the degree to which the input is moved toward the output.
That would also be an option but with the changes I just made the API works the same as torch.where
where True
selects input
and False
selects other. I don't have a strong opinion which one is better.
The function
randsel
takes a parameterp
which the documentation states is the probability of selecting a value from theinput
vector. So it should be true thatrandsel(x, y, p=1) == x
. However, this is not true and insteadrandsel(x, y, p=0) == x
andrandsel(x, y, p=1) == y
.p
is the probability of not selecting from theinput
vector. I suspect you have a1-p
in your code where you should just havep
.