def _compute_causal_padding(inputs, rank, data_format, dilation_rate, kernel_size):
    """Calculates padding for 'causal' option for 1-d and 2-d conv layers."""
    batch_pad = [[0, 0]]
    channel_pad = [[0, 0]]
    height_pad = [[dilation_rate[0] * (kernel_size[0] - 1), 0]]
    if rank == 1:
        if data_format == "channels_last":
            return batch_pad + height_pad + channel_pad
        return batch_pad + channel_pad + height_pad
    width_pad = [[dilation_rate[1] * (kernel_size[1] - 1), 0]]
    if data_format == "channels_last":
        return batch_pad + height_pad + width_pad + channel_pad
    return batch_pad + channel_pad + height_pad + width_pad
Calculates padding for 'causal' option for 1-d and 2-d conv layers.
tensorflow_asr/models/layers/convolution.py