Diffusers documentation

Hàm kích hoạt

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

Hàm kích hoạt

Các hàm kích hoạt tùy chỉnh để hỗ trợ nhiều mô hình khác nhau trong 🤗 Diffusers.

GELU

lớp diffusers.models.activations.GELU

< >

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

Tham số

  • dim_in (int) — Số kênh trong đầu vào.
  • dim_out (int) — Số lượng kênh trong đầu ra.
  • approximate (str, tuỳ chọn, mặc định là "none") — Nếu là "tanh", sử dụng xấp xỉ tanh.
  • bias (bool, mặc định là True) — Có sử dụng bias trong lớp tuyến tính hay không.

Hàm kích hoạt GELU với hỗ trợ xấp xỉ tanh bằng approximate="tanh".

GEGLU

lớp diffusers.models.activations.GEGLU

< >

( dim_in: intdim_out: intbias: bool = True )

Tham số

  • dim_in (int) — Số kênh trong đầu vào.
  • dim_out (int) — Số lượng kênh trong đầu ra.
  • bias (bool, mặc định là True) — Có sử dụng bias trong lớp tuyến tính hay không.

Một biến thể của hàm kích hoạt gated linear unit.

ApproximateGELU

lớp diffusers.models.activations.ApproximateGELU

< >

( dim_in: intdim_out: intbias: bool = True )

Tham số

  • dim_in (int) — Số kênh trong đầu vào.
  • dim_out (int) — Số lượng kênh trong đầu ra.
  • bias (bool, mặc định là True) — Có sử dụng bias trong lớp tuyến tính hay không.

Dạng xấp xỉ của Gaussian Error Linear Unit (GELU). Để biết thêm chi tiết, hãy xem mục 2 của bài báo này.

SwiGLU

lớp diffusers.models.activations.SwiGLU

< >

( dim_in: intdim_out: intbias: bool = True )

Tham số

  • dim_in (int) — Số kênh trong đầu vào.
  • dim_out (int) — Số lượng kênh trong đầu ra.
  • bias (bool, mặc định là True) — Có sử dụng bias trong lớp tuyến tính hay không.

Một biến thể của hàm kích hoạt gated linear unit. Nó tương tự GEGLU nhưng sử dụng SiLU / Swish thay vì GeLU.

FP32SiLU

lớp diffusers.models.activations.FP32SiLU

< >

( )

Hàm kích hoạt SiLU với đầu vào được chuyển lên torch.float32.

LinearActivation

lớp diffusers.models.activations.LinearActivation

< >

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

Update on GitHub