# 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[[diffusers.models.activations.GELU]]

#### diffusers.models.activations.GELU[[diffusers.models.activations.GELU]]

```python
diffusers.models.activations.GELU(dim_in: int, dim_out: int, approximate: str = 'none', bias: bool = True)
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/activations.py#L65)

**Tham số:**

dim_in (`int`) : Số lượng kênh trong đầu vào.

dim_out (`int`) : Số lượng kênh trong đầu ra.

approximate (`str`, *tùy chọn*, mặc định là `"none"`) : Nếu là `"tanh"`, hãy 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[[diffusers.models.activations.GEGLU]]

#### diffusers.models.activations.GEGLU[[diffusers.models.activations.GEGLU]]

```python
diffusers.models.activations.GEGLU(dim_in: int, dim_out: int, bias: bool = True)
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/activations.py#L90)

**Tham số:**

dim_in (`int`) : Số lượng 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ể](https://huggingface.co/papers/2002.05202) của hàm kích hoạt gated linear unit.

## ApproximateGELU[[diffusers.models.activations.ApproximateGELU]]

#### diffusers.models.activations.ApproximateGELU[[diffusers.models.activations.ApproximateGELU]]

```python
diffusers.models.activations.ApproximateGELU(dim_in: int, dim_out: int, bias: bool = True)
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/activations.py#L143)

**Tham số:**

dim_in (`int`) : Số lượng 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](https://huggingface.co/papers/1606.08415) này.

## SwiGLU[[diffusers.models.activations.SwiGLU]]

#### diffusers.models.activations.SwiGLU[[diffusers.models.activations.SwiGLU]]

```python
diffusers.models.activations.SwiGLU(dim_in: int, dim_out: int, bias: bool = True)
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/activations.py#L120)

**Tham số:**

dim_in (`int`) : Số lượng 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ể](https://huggingface.co/papers/2002.05202) 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[[diffusers.models.activations.FP32SiLU]]

#### diffusers.models.activations.FP32SiLU[[diffusers.models.activations.FP32SiLU]]

```python
diffusers.models.activations.FP32SiLU()
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/activations.py#L53)

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

## LinearActivation[[diffusers.models.activations.LinearActivation]]

#### diffusers.models.activations.LinearActivation[[diffusers.models.activations.LinearActivation]]

```python
diffusers.models.activations.LinearActivation(dim_in: int, dim_out: int, bias: bool = True, activation: str = 'silu')
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/activations.py#L163)

