code: def frequency_weighted_cost_mask(
      peak=10.0, hz_flat=1000, sr=16000, n_fft=512
  ):
      """Calculates a mask to weight lower frequencies higher.
  
      Piecewise linear approximation. Assumes magnitude is in log scale.
      Args:
        peak: Cost increase at 0 Hz.
        hz_flat: Hz at which cost increase is 0.
        sr: Sample rate.
        n_fft: FFT size.
  
      Returns:
        Constant tensor [1, N_freq, 1] of cost weighting.
      """
      n = int(n_fft / 2)
      cutoff = np.where(
          librosa.core.fft_frequencies(sr=sr, n_fft=n_fft) >= hz_flat
      )[0][0]
      mask = np.concatenate(
          [np.linspace(peak, 1.0, cutoff), np.ones(n - cutoff)]
      )
      return tf.constant(
          mask[np.newaxis, :, np.newaxis], dtype=tf.float32
      )
  
imports: import importlib
  import os
  import librosa
  import numpy
  import tensorflow.compat.v1
  import tf_slim
label_desc: Use image node_id 23 for calling a global function with example usage: frequency_weighted_cost_mask(peak, hz_flat, sr, n_fft) and returns: tf