So I was reading the pytorch document trying to learn and understand somethings(because I'm new to the machine learning ), I found the torch.bernoulli()
and I understood (I miss understood it) that it approximates the tensors that the have the values between 1 and 0 to 1 or 0 depends on the value (like classic school less than 0.5 = 0 , more the than or equals 0.5 = 1)
After some experimentations on my own that yeah it works as expected
>>>y = torch.Tensor([0.500])
>>>x
>>> 0.5000
[torch.FloatTensor of size 1]
>>> torch.bernoulli(x)
>>> 1
[torch.FloatTensor of size 1]
But when I looked at the document something a bit weird
>>> a = torch.Tensor(3, 3).uniform_(0, 1) # generate a uniform random matrix with range [0, 1]
>>> a
0.7544 0.8140 0.9842
**0.5282** 0.0595 0.6445
0.1925 0.9553 0.9732
[torch.FloatTensor of size 3x3]
>>> torch.bernoulli(a)
1 1 1
**0** 0 1
0 1 1
[torch.FloatTensor of size 3x3]
in the example the 0.5282 got approximated to 0 , how did that happen ? or it's a fault in the document because I tried it and the 0.5282 got approximated as expected to 1.