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.])
Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐