def METHOD_NAME(
        self,
        x: paddle.Tensor,
        x_lengths: paddle.Tensor,
) -> Tuple[paddle.Tensor, paddle.Tensor, paddle.Tensor, paddle.Tensor]:
    """Calculate forward propagation.
    Args:
        x (Tensor):
            Input index tensor (B, T_text).
        x_lengths (Tensor):
            Length tensor (B,).
    Returns:
        Tensor:
            Encoded hidden representation (B, attention_dim, T_text).
        Tensor:
            Projected mean tensor (B, attention_dim, T_text).
        Tensor:
            Projected scale tensor (B, attention_dim, T_text).
        Tensor:
            Mask tensor for input tensor (B, 1, T_text).
    """
    x = self.emb(x) * math.sqrt(self.attention_dim)
    x_mask = make_non_pad_mask(x_lengths).unsqueeze(1)
    # encoder assume the channel last (B, T_text, attention_dim)
    # but mask shape shoud be (B, 1, T_text)
    x, _ = self.encoder(x, x_mask)
    # convert the channel first (B, attention_dim, T_text)
    x = paddle.transpose(x, [0, 2, 1])
    stats = self.proj(x) * x_mask
    m, logs = paddle.split(stats, 2, axis=1)
    return x, m, logs, x_mask