code: def convolution_invariant_target_numpy(
      estimate: np.ndarray,
      target: np.ndarray,
      filter_length,
      diag_reg: float = 1e-6,
      eps: float = 1e-8,
  ) -> np.ndarray:
      """Calculate convolution-invariant target for a given estimated signal.
  
      Calculate target filtered with a linear f obtained by solving
  
          min_filter || conv(filter, target) - estimate ||^2
  
      Args:
          estimate: one-dimensional estimated signal
          target: one-dimensional target signal
          filter_length: length of the (convolutive) filter
          diag_reg: multiplicative factor for relative diagonal loading
          eps: absolute diagonal loading
      """
      assert (
          target.ndim == estimate.ndim == 1
      ), f"Only one-dimensional inputs supported"
  
      n_fft = 2 ** math.ceil(math.log2(len(target) + len(estimate) - 1))
  
      T = np.fft.rfft(target, n=n_fft)
      E = np.fft.rfft(estimate, n=n_fft)
  
      # target autocorrelation
      tt_corr = np.fft.irfft(np.abs(T) ** 2, n=n_fft)
      # target-estimate crosscorrelation
      te_corr = np.fft.irfft(T.conj() * E, n=n_fft)
  
      # Use only filter_length
      tt_corr = tt_corr[:filter_length]
      te_corr = te_corr[:filter_length]
  
      if diag_reg is not None:
          tt_corr[0] += diag_reg * tt_corr[0] + eps
  
      # Construct the Toeplitz system matrix
      TT = scipy.linalg.toeplitz(tt_corr)
  
      # Solve the linear system for the optimal filter
      filt = np.linalg.solve(TT, te_corr)
  
      # Calculate filtered target
      T_filt = T * np.fft.rfft(filt, n=n_fft)
      target_filt = np.fft.irfft(T_filt, n=n_fft)
  
      return target_filt[: len(target)]
  
imports: import math
  from typing import Iterable, Optional, Union
  import librosa
  import numpy
  import numpy.typing
  import scipy
  import soundfile
  import torch
  from scipy.spatial.distance import pdist, squareform
  from nemo.utils import logging
label_desc: Use image node_id 18 for calling a global function with example usage: convolution_invariant_target_numpy(estimate, target, filter_length, diag_reg, eps) and returns: target_filt