mlx.nn.step

目录

mlx.nn.step#

class step(x: array, threshold: float = 0.0)#

应用 Step 激活函数。

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

\[\begin{split}\text{阶跃}(x) = \begin{cases} 0 & \text{如果 } x < \text{阈值} \\ 1 & \text{如果 } x \geq \text{阈值} \end{cases}\end{split}\]
参数:

threshold – 阈值。