Diffusers documentation

激活函数

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v0.42.1).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

激活函数

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

GELU

类 diffusers.models.activations.GELU

< >

( dim_in: intdim_out: intapproximate: str = 'none'bias: bool = True )

参数

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

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

GEGLU

类 diffusers.models.activations.GEGLU

< >

( dim_in: intdim_out: intbias: bool = True )

参数

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

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

ApproximateGELU

类 diffusers.models.activations.ApproximateGELU

< >

( dim_in: intdim_out: intbias: bool = True )

参数

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

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

SwiGLU

类 diffusers.models.activations.SwiGLU

< >

( dim_in: intdim_out: intbias: bool = True )

参数

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

门控线性单元激活函数的变体。它与GEGLU类似,但使用 SiLU / Swish 代替 GeLU。

FP32SiLU

类 diffusers.models.activations.FP32SiLU

< >

( )

输入被上转换为 torch.float32 的 SiLU 激活函数。

LinearActivation

类 diffusers.models.activations.LinearActivation

< >

( dim_in: intdim_out: intbias: bool = Trueactivation: str = 'silu' )

Update on GitHub