code: def local_global_attention(
      x,
      self_attention_bias,
      hparams,
      q_padding="LEFT",
      kv_padding="LEFT",
  ):
      """Local and global 1d self attention."""
      with tf.variable_scope("self_local_global_att"):
          [x_global, x_local] = tf.split(x, 2, axis=-1)
          split_hidden_size = int(hparams.hidden_size / 2)
          split_heads = int(hparams.num_heads / 2)
          if self_attention_bias is not None:
              self_attention_bias = get_self_attention_bias(x)
          y_global = common_attention.multihead_attention(
              x_global,
              None,
              self_attention_bias,
              hparams.attention_key_channels or split_hidden_size,
              hparams.attention_value_channels or split_hidden_size,
              split_hidden_size,
              split_heads,
              hparams.attention_dropout,
              q_filter_width=hparams.q_filter_width,
              kv_filter_width=hparams.kv_filter_width,
              q_padding=q_padding,
              kv_padding=kv_padding,
              name="global_self_att",
          )
          y_local = common_attention.multihead_attention(
              x_local,
              None,
              None,
              hparams.attention_key_channels or split_hidden_size,
              hparams.attention_value_channels or split_hidden_size,
              split_hidden_size,
              split_heads,
              hparams.attention_dropout,
              attention_type="local_masked",
              block_length=hparams.block_length,
              block_width=hparams.block_width,
              q_filter_width=hparams.q_filter_width,
              kv_filter_width=hparams.kv_filter_width,
              q_padding=q_padding,
              kv_padding=kv_padding,
              name="local_self_att",
          )
          y = tf.concat([y_global, y_local], axis=-1)
          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 7 for calling a global function with example usage: local_global_attention(x, _attention_bias, hparams, q_padding, kv_padding) and returns: y