code: def create_speech_rir(
      audios, rir, lengths_audios, max_len, batch_size
  ):
      """
      Returns:
          A tensor of speech with reverberations (Convolve the audio with the rir)
      """
      speech_rir = []
  
      for i in range(batch_size):
          s1 = lengths_audios[i]
          s2 = tf.convert_to_tensor(tf.shape(rir))
          shape = s1 + s2 - 1
  
          # Compute convolution in fourier space
          sp1 = tf.spectral.rfft(rir, shape)
          sp2 = tf.spectral.rfft(
              tf.slice(
                  tf.reshape(
                      audios[i],
                      [
                          -1,
                      ],
                  ),
                  [0],
                  [lengths_audios[i]],
              ),
              shape,
          )
          ret = tf.spectral.irfft(sp1 * sp2, shape)
  
          # normalization
          ret /= tf.reduce_max(tf.abs(ret))
          ret *= 2 ** (16 - 1) - 1
          ret = tf.clip_by_value(
              ret, -(2 ** (16 - 1)), 2 ** (16 - 1) - 1
          )
          ret = tf.pad(ret, tf.constant([[0, 100000]]))
          ret = ret[:max_len]
  
          speech_rir.append(tf.expand_dims(ret, axis=0))
      speech_rirs = tf.concat(speech_rir, axis=0)
      return speech_rirs
  
file_path: cleverhans/cleverhans_v3.1.0/examples/adversarial_asr/tool.py
imports: from tensorflow.python import pywrap_tensorflow
  import numpy
  import tensorflow
  from lingvo.core import asr_frontend
  from lingvo.core import py_utils
label_desc: Use image node_id 5 for calling a global function with example usage: create_speech_rir(audios, rir, lengths_audios, max_len, batch_size) and returns: speech_rirs