class_docstr: Refer to [Learning Natural Language Inference with LSTM]
    (https://www.aclweb.org/anthology/N16-1170)
    wrap `with tf.variable_scope(name, reuse=tf.AUTO_REUSE):`
  Input shape: (Batch size, steps, features)
  Output shape: (Batch size, steps, features)
class_docstr_tok: ["Refer","to","[","Learning","Natural","Language","Inference","with","LSTM","]","(","https",":","\/\/www.aclweb.org\/anthology\/N16-1170",")","wrap","`","with","tf.variable_scope","(","name",",","reuse=tf.AUTO_REUSE",")",":","`","Input","shape",":","(","Batch","size",",","steps",",","features",")","Output","shape",":","(","Batch","size",",","steps",",","features",")"]
docstr: Attention layer.
docstr_tok: ["Attention","layer","."]
code: def call(self, tensors):
      """Attention layer."""
      left, right = tensors
  
      len_left = left.shape[1]
      len_right = right.shape[1]
      tensor_left = tf.expand_dims(left, axis=2)
      tensor_right = tf.expand_dims(right, axis=1)
      tensor_left = tf.tile(tensor_left, [1, 1, len_right, 1])
      tensor_right = tf.tile(tensor_right, [1, len_left, 1, 1])
      tensor_merged = tf.concat([tensor_left, tensor_right], axis=-1)
      middle_output = self.middle_layer(tensor_merged)
      attn_scores = self.attn(middle_output)
      attn_scores = tf.squeeze(attn_scores, axis=3)
      exp_attn_scores = tf.exp(
          attn_scores
          - tf.reduce_max(attn_scores, axis=-1, keepdims=True)
      )
      exp_sum = tf.reduce_sum(exp_attn_scores, axis=-1, keepdims=True)
      attention_weights = exp_attn_scores / exp_sum
      return tf.matmul(attention_weights, right)
  
file_path: delta/delta/layers/attention.py
imports: from absl import logging
  import delta.compat
  from delta.layers.base_layer import Layer
label_desc: Use image node_id 2 for calling the MatchAttention obj's underlying member method code with example usage: obj.call(tensors) and returns: tf