mlx.nn.Step

目录

mlx.nn.Step#

class Step(threshold: float = 0.0)#

应用 Step 激活函数。

此函数实现二进制阶跃激活,当输入大于指定的阈值时输出设置为 1,否则设置为 0。

\[\begin{split}\text{step}(x) = \begin{cases} 0 & \text{if } x < \text{threshold} \\ 1 & \text{if } x \geq \text{threshold} \end{cases}\end{split}\]
参数:

threshold – 用于设定阈值的值。

方法