mlx.nn.glu

目錄

mlx.nn.glu#

class glu(x: array, axis: int = -1)#

套用閘控線性單元(GLU)函式。

此函式會將輸入的 axis 維度切成兩半(\(a\)\(b\)),並套用 \(a * \sigma(b)\)

\[\textrm{GLU}(x) = a * \sigma(b)\]
參數:

axis (int) -- 要沿著切分的維度。預設:-1