Diffusers 文档

激活函数

Hugging Face's logo
加入 Hugging Face 社区

并获取增强的文档体验

开始使用

激活函数

自定义激活函数,用于支持 🤗 Diffusers 中的各种模型。

GELU

diffusers.models.activations.GELU

< >

( dim_in: int dim_out: int approximate: str = 'none' bias: bool = True )

参数

  • dim_in (int) — 输入通道数。
  • dim_out (int) — 输出通道数。
  • approximate (str, 可选, 默认为 "none") — 如果为 "tanh",则使用 tanh 近似。
  • bias (bool, 默认为 True) — 是否在线性层中使用偏置。

GELU 激活函数,支持使用 approximate="tanh" 进行 tanh 近似。

GEGLU

diffusers.models.activations.GEGLU

< >

( dim_in: int dim_out: int bias: bool = True )

参数

  • dim_in (int) — 输入通道数。
  • dim_out (int) — 输出通道数。
  • bias (bool, 默认为 True) — 是否在线性层中使用偏置。

门控线性单元激活函数的 变体

ApproximateGELU (近似GELU)

class diffusers.models.activations.ApproximateGELU

< >

( dim_in: int dim_out: int bias: bool = True )

参数

  • dim_in (int) — 输入通道的数量。
  • dim_out (int) — 输出通道的数量。
  • bias (bool, 默认为 True) — 是否在线性层中使用偏置。

高斯误差线性单元 (GELU) 的近似形式。 更多细节请参阅这篇论文的第 2 节。

< > Update (更新) on GitHub