def exponential_power(x, mean, fwhm, shape):
        """
        Computes the generalized Gaussian function:

        .. math::

             F(x) = \\exp\\left( - \\left( \\frac{|x - \\mu|}{\\alpha} \\right)^{\\beta} \\right)

        where:

          - :math:`\\mu` is the mean (`mean`).

          - :math:`\\alpha` is the scale parameter, reparameterized using the FWHM :math:`h` as:

            .. math::

                \\alpha = \\frac{h}{2 \\left( \\ln(2) \\right)^{1/\\beta}}

          - :math:`\\beta` is the shape parameter (`shape`).

        Parameters
        ----------
        x : torch.Tensor
            The input tensor representing frequencies, normalized between 0 and 1.
        mean : torch.Tensor
            The center frequency (`f_mean`), normalized between 0 and 1.
        fwhm : torch.Tensor
            The full width at half maximum (`bandwidth`), normalized between 0 and 1.
        shape : torch.Tensor
            The shape parameter (`shape`) of the generalized Gaussian.

        Returns
        -------
        torch.Tensor
            The computed generalized Gaussian function values at frequencies `x`.

        """
        mean = mean.unsqueeze(1)
        fwhm = fwhm.unsqueeze(1)
        shape = shape.unsqueeze(1)
        log2 = torch.log(torch.tensor(2.0, device=x.device, dtype=x.dtype))
        scale = fwhm / (2 * log2 ** (1 / shape))
        # Add small constant to difference between x and mean since grad of 0 ** shape is nan
        return torch.exp(-((((x - mean).abs() + 1e-8) / scale) ** shape))

        Computes the generalized Gaussian function:

        .. math::

             F(x) = \exp\left( - \left( \frac{|x - \mu|}{\alpha} \right)^{\beta} \right)

        where:

          - :math:`\mu` is the mean (`mean`).

          - :math:`\alpha` is the scale parameter, reparameterized using the FWHM :math:`h` as:

            .. math::

                \alpha = \frac{h}{2 \left( \ln(2) \right)^{1/\beta}}

          - :math:`\beta` is the shape parameter (`shape`).

        Parameters
        ----------
        x : torch.Tensor
            The input tensor representing frequencies, normalized between 0 and 1.
        mean : torch.Tensor
            The center frequency (`f_mean`), normalized between 0 and 1.
        fwhm : torch.Tensor
            The full width at half maximum (`bandwidth`), normalized between 0 and 1.
        shape : torch.Tensor
            The shape parameter (`shape`) of the generalized Gaussian.

        Returns
        -------
        torch.Tensor
            The computed generalized Gaussian function values at frequencies `x`.

        
braindecode/modules/filter.py