Hi Yegane!



 yegane:

How can I have it in a backpropagation?


You can’t use the actual Heaviside function in backpropagation.
Use instead a “soft,” usefully-differentiable approximation to it
such as torch.sigmoid().


If it is is non-differentiable, is there any function that produces 1,0 only?


There is no such function that would be useful for backpropagation.
Such a function would have zero derivative in regions where it was
either zero or one and would have undefined derivative at those
points where it changed from zero to one.  In neither case would
you get any non-trivial backpropagation.
Best.
K. Frank