I am facing probelm
RuntimeError: Expected p_in >= 0 && p_in <= 1 to be true, but got false.  (Could this error message be improved?  If so, please report an enhancement request to PyTorch.)

for the following problem
class SigmoidForwardLinearBackward(torch.autograd.Function):
@staticmethod
def forward(ctx, ins):
# return torch.nn.functional.sigmoid(ins)
     return torch.bernoulli(ins)
    

@staticmethod
def backward(ctx, grad_output):
    return grad_output

MyFunction = SigmoidForwardLinearBackward.apply
plt.figure()

sigmoids = []
bernoulli = []
backwards = []
for x in torch.arange(-5, 5, 0.01):
x.requires_grad = True
outs = MyFunction(x)
outs.backward()
bernoulli.append(outs)
backwards.append(x.grad)