code: def attention_bias_local(length, max_backward, max_forward):
    
    band = common_layers.ones_matrix_band_part(
        length,
        length,
        max_backward,
        max_forward,
        out_shape=[1, 1, length, length])
    return -1e9 * (1.0 - band)
docs: Create an bias tensor to be added to attention logits.
  
    A position may attend to positions at most max_distance from it,
    forward and backwards.
  
    This does not actually save any computation.
  
    Args:
      length: int
      max_backward: int, maximum distance backward to attend. Negative values
        indicate unlimited.
      max_forward: int, maximum distance forward to attend. Negative values
        indicate unlimited.
  
    Returns:
      a `Tensor` with shape [1, 1, length, length].