Diffusers
加入 Hugging Face 社群
並獲得增強的文件體驗
啟用函式
用於支援 🤗 Diffusers 中各種模型的自定義啟用函式。
GELU
class 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) — 是否線上性層中使用偏置。
支援 tanh 近似(透過 approximate="tanh"
)的 GELU 啟用函式。
GEGLU
class diffusers.models.activations.GEGLU
< 來源 > ( dim_in: int dim_out: int bias: bool = True )
引數
- dim_in (
int
) — 輸入通道數。 - dim_out (
int
) — 輸出通道數。 - bias (
bool
, 預設為 True) — 是否線上性層中使用偏置。
門控線性單元啟用函式的一個 變體。
ApproximateGELU
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 節。
SwiGLU
class diffusers.models.activations.SwiGLU
< 來源 > ( dim_in: int dim_out: int bias: bool = True )
引數
- dim_in (
int
) — 輸入通道數。 - dim_out (
int
) — 輸出通道數。 - bias (
bool
, 預設為 True) — 是否線上性層中使用偏置。
門控線性單元啟用函式的一個 變體。它類似於 GEGLU
,但使用 SiLU / Swish 而非 GeLU。
FP32SiLU
class diffusers.models.activations.FP32SiLU
< 來源 > ( )
SiLU 啟用函式,輸入上轉為 torch.float32。
LinearActivation
class diffusers.models.activations.LinearActivation
< 來源 > ( dim_in: int dim_out: int bias: bool = True activation: str = 'silu' )
< > 在 GitHub 上更新
© . This site is unofficial and not affiliated with Hugging Face, Inc.