numpy.heaviside(x1,x2)
Compute the Heaviside step function.
官方链接
x1 [array_like] Input values.
x2 [array_like] The value of the function when x1 is 0.
示例:
np.heaviside([-1.5, 0, 2.0], 0.5)
array([ 0. , 0.5, 1. ])
np.heaviside([-1.5, 0, 2.0], 1)
array([ 0., 1., 1.])