def forward(self, x):
        """
        Apply the Convolutional Block Attention Module to the input tensor.

        Parameters
        ----------
        x: Pytorch.Tensor

        Returns
        -------
        Pytorch.Tensor
        """
        channel_attention = torch.sigmoid(
            self.fc(self.avg_pool(x)) + self.fc(self.max_pool(x))
        )
        x = x * channel_attention
        spat_input = torch.cat(
            [torch.mean(x, dim=1, keepdim=True), torch.max(x, dim=1, keepdim=True)[0]],
            dim=1,
        )
        spatial_attention = torch.sigmoid(self.conv(spat_input))
        return x * spatial_attention

        Apply the Convolutional Block Attention Module to the input tensor.

        Parameters
        ----------
        x: Pytorch.Tensor

        Returns
        -------
        Pytorch.Tensor
        
braindecode/modules/attention.py