def overlap_add_conv1d(inputs: tf.Tensor,
                       filters: tf.Tensor,
                       fft_length: int = 4096) -> tf.Tensor:
    """FFT based convolution in 1D, using the overlap-add method.

    Args:
     inputs: a tf.Tensor<float>[batch_size, seq_length, 1] of input sequences.
     filters: a tf.Tensor<float>[filter_length, 1, channels].
     fft_length: an int, the length of the Fourier transform.

    Returns:
     A tf.Tensor<float>[batch_size, seq_length, channels] containing the response
     to the 1D convolutions with the filters.
    """
    seq_len = tf.shape(inputs)[1]
    filter_len = tf.shape(filters)[0]
    overlap = filter_len - 1
    seg_size = fft_length - overlap
    f_filters = tf.expand_dims(
        tf.signal.rfft(tf.transpose(filters, (1, 2, 0)), fft_length=[fft_length]),
        axis=2)
    framed = tf.signal.frame(
        tf.transpose(inputs, (0, 2, 1)),
        frame_length=seg_size,
        frame_step=seg_size,
        pad_end=True)
    paddings = [[0, 0], [0, 0], [0, 0], [int(overlap / 2), int(overlap / 2)]]
    framed = tf.pad(framed, paddings)
    f_inputs = tf.signal.rfft(framed, fft_length=[fft_length])
    result = tf.signal.irfft(f_inputs * tf.math.conj(f_filters))
    result = tf.roll(result, filter_len // 2 - 1, axis=-1)
    result = tf.signal.overlap_and_add(result, frame_step=seg_size)
    result = tf.transpose(result, (0, 2, 1))[..., :seq_len, :]
    output = tf.roll(result, 1 - filter_len // 2, axis=1)
    shape = tf.concat([tf.shape(inputs)[:-1], tf.shape(filters)[-1:]], axis=0)
    return tf.reshape(output, shape)
FFT based convolution in 1D, using the overlap-add method.

    Args:
     inputs: a tf.Tensor<float>[batch_size, seq_length, 1] of input sequences.
     filters: a tf.Tensor<float>[filter_length, 1, channels].
     fft_length: an int, the length of the Fourier transform.

    Returns:
     A tf.Tensor<float>[batch_size, seq_length, channels] containing the response
     to the 1D convolutions with the filters.
    
leaf_audio/convolution.py