    def forward(self, x, pad_mask=None, attn_mask=None):
        """
        Forward function.
        Args:
            x (`Tensor`):
                Input tensor
            pad_mask (`Tensor`):
                Padding mask.
            attn_mask (`Tensor`):
                Attention mask.
        """
        x = self.norm(x)
        return self.attention(x, x, pad_mask=pad_mask, attn_mask=attn_mask)
Forward function.
Args:
x (`Tensor`):
Input tensor
pad_mask (`Tensor`):
Padding mask.
attn_mask (`Tensor`):
Attention mask.
towhee/models/perceiver/self_attention.py