def interpolate(x, ratio):
    """Interpolate the prediction to compensate the downsampling operation in a
    CNN.
    
    Args:
      x: (batch_size, time_steps, classes_num)
      ratio: int, ratio to upsample
    """
    batch_size, time_steps, classes_num = x.shape
    upsampled = x[:, :, (None), :].repeat(1, 1, ratio, 1)
    upsampled = upsampled.reshape(batch_size, time_steps * ratio, classes_num)
    return upsampled
