code: def local_within_block_attention(
      x,
      self_attention_bias,
      hparams,
      attention_type="local_within_block_mask_right",
      q_padding="VALID",
      kv_padding="VALID",
  ):
      """Local within block self attention."""
      x_new, x_shape, is_4d = maybe_reshape_4d_to_3d(x)
      with tf.variable_scope("local_within_block"):
          y = common_attention.multihead_attention(
              common_layers.layer_preprocess(x_new, hparams),
              None,
              self_attention_bias,
              hparams.attention_key_channels or hparams.hidden_size,
              hparams.attention_value_channels or hparams.hidden_size,
              hparams.hidden_size,
              hparams.num_heads,
              hparams.attention_dropout,
              attention_type=attention_type,
              block_width=hparams.block_width,
              block_length=hparams.block_length,
              q_padding=q_padding,
              kv_padding=kv_padding,
              q_filter_width=hparams.q_filter_width,
              kv_filter_width=hparams.kv_filter_width,
              name="local_within_block",
          )
          if is_4d:
              y = tf.reshape(y, x_shape)
          return y
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  from six.moves import range
  from tensor2tensor.layers import common_attention
  from tensor2tensor.layers import common_layers
  from tensor2tensor.utils import expert_utils
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 3 for calling a global function with example usage: local_within_block_attention(x, _attention_bias, hparams, attention_type, q_padding, kv_padding) and returns: y