
    i
                        d dl Z d dlmZ  e j                          e j                  e j
                        j                  dfde j                  de j                  fd       Z e j                         de j                  de	de	de j                  fd	       Z
 e j                         dd
edededede j                  f
d       Zy)    N)Number(   xreturnc                     dt        j                  | j                         |z         z  }t        j                  ||j                  d      j                  |z
  j                  d            S )a  
    Convert the input tensor from amplitude to decibel scale.

    Arguments:
        x {[torch.Tensor]} -- [Input tensor.]

    Keyword Arguments:
        eps {[float]} -- [Small value to avoid numerical instability.]
                          (default: {torch.finfo(torch.float64).eps})
        top_db {[float]} -- [threshold the output at ``top_db`` below the peak]
            `             (default: {40})

    Returns:
        [torch.Tensor] -- [Output tensor in decibel scale.]
       )torchlog10absmaxvalues	unsqueeze)r   epstop_dbx_dbs       Y/var/www/html/dev/engine/venv/lib/python3.12/site-packages/noisereduce/torchgate/utils.py	amp_to_dbr      sP    " AEEGcM**D99TDHHRL//&8CCBGHH    x0
temp_coeffc                 8    t        j                  | |z
  |z        S )a  
    Apply a sigmoid function with temperature scaling.

    Arguments:
        x {[torch.Tensor]} -- [Input tensor.]
        x0 {[float]} -- [Parameter that controls the threshold of the sigmoid.]
        temp_coeff {[float]} -- [Parameter that controls the slope of the sigmoid.]

    Returns:
        [torch.Tensor] -- [Output tensor after applying the sigmoid with temperature scaling.]
    )r
   sigmoid)r   r   r   s      r   temperature_sigmoidr      s     ==!b&J.//r   startstopnumendpointc                 r    |rt        j                  | ||fi |S t        j                  | ||dz   fi |dd S )a  
    Generate a linearly spaced 1-D tensor.

    Arguments:
        start {[Number]} -- [The starting value of the sequence.]
        stop {[Number]} -- [The end value of the sequence, unless `endpoint` is set to False.
                            In that case, the sequence consists of all but the last of ``num + 1``
                            evenly spaced samples, so that `stop` is excluded. Note that the step
                            size changes when `endpoint` is False.]

    Keyword Arguments:
        num {[int]} -- [Number of samples to generate. Default is 50. Must be non-negative.]
        endpoint {[bool]} -- [If True, `stop` is the last sample. Otherwise, it is not included.
                              Default is True.]
        **kwargs -- [Additional arguments to be passed to the underlying PyTorch `linspace` function.]

    Returns:
        [torch.Tensor] -- [1-D tensor of `num` equally spaced samples from `start` to `stop`.]
       Nr	   )r
   linspace)r   r   r   r   kwargss        r   r!   r!   *   sB    * ~~eT39&99~~eT37=f=crBBr   )2   T)r
   torch.typesr   no_gradfinfofloat64r   Tensorr   floatr   intboolr!    r   r   <module>r-      s      #.5;;u}}#=#A#A" I IQVQ]Q] I I( 05<< 0U 0 0%,, 0 0 CF C& Cs C4 C]b]i]i C Cr   