class_docstr: Defines end to end MatchLSTM and Answer_Pointer network for Reading Comprehension
class_docstr_tok: ["Defines","end","to","end","MatchLSTM","and","Answer_Pointer","network","for","Reading","Comprehension"]
docstr: Function to run the answer pointer pass:
  
  Args:
      None
  
  Returns:
      List of logits for start and end indices of the answer
docstr_tok: ["Function","to","run","the","answer","pointer","pass",":","Args",":","None","Returns",":","List","of","logits","for","start","and","end","indices","of","the","answer"]
code: def answer_pointer_pass(self):
      """
      Function to run the answer pointer pass:
  
      Args:
          None
  
      Returns:
          List of logits for start and end indices of the answer
      """
  
      V_r_expanded = tf.tile(self.V_r, [self.batch_size, 1, 1])
      W_a_expanded = tf.tile(self.W_a, [self.batch_size, 1, 1])
      b_a_expanded = tf.tile(self.b_a, [self.batch_size, 1, 1])
      mask_multiplier_1 = tf.expand_dims(self.para_mask, 1)
      mask_multiplier = self.ones_para_exp
  
      v_apointer_exp = tf.tile(
          self.v_a_pointer, [self.batch_size, 1, 1]
      )
  
      # Zero initialization
      h_k_old = tf.constant(
          np.zeros([self.batch_size, self.hidden_size, 1]),
          dtype=tf.float32,
      )
  
      b_k_lists = []
  
      print("Answer Pointer Pass")
  
      for i in range(0, 2):
          sum1 = tf.matmul(V_r_expanded, self.stacked_lists)
          sum2 = tf.matmul(W_a_expanded, h_k_old) + b_a_expanded
          F_k = tf.nn.tanh(sum1 + tf.matmul(sum2, mask_multiplier))
  
          b_k_withoutsf = tf.matmul(v_apointer_exp, F_k)
  
          b_k = tf.nn.softmax(b_k_withoutsf + tf.log(mask_multiplier_1))
          lstm_cell_inp = tf.squeeze(
              tf.matmul(
                  self.stacked_lists, tf.transpose(b_k, [0, 2, 1])
              ),
              axis=2,
          )
  
          with tf.variable_scope("lstm_pointer"):
              if i == 0:
                  h_k_old, cell_state_pointer = self.lstm_pointer_cell(
                      lstm_cell_inp,
                      state=self.lstm_pointer_cell.zero_state(
                          self.batch_size, dtype=tf.float32
                      ),
                  )
              else:
                  h_k_old, cell_state_pointer = self.lstm_pointer_cell(
                      lstm_cell_inp, state=cell_state_pointer
                  )
  
          h_k_old = tf.expand_dims(h_k_old, 2)
          b_k_lists.append(b_k_withoutsf + tf.log(mask_multiplier_1))
  
      self.logits_withsf = [
          tf.nn.softmax(tf.squeeze(b_k_lists[0], axis=1)),
          tf.nn.softmax(tf.squeeze(b_k_lists[1], axis=1)),
      ]
  
      return [
          tf.squeeze(b_k_lists[0], axis=1),
          tf.squeeze(b_k_lists[1], axis=1),
      ]
  
file_path: nlp-architect/examples/reading_comprehension/match_lstm_mrc/matchlstm_ansptr.py
imports: from __future__ import division
  from __future__ import print_function
  import re
  from collections import Counter
  import numpy
  import tensorflow
  from nlp_architect.utils.text import SpacyInstance
label_desc: Use image node_id 5 for calling the MatchLSTMAnswerPointer obj's underlying member method code with example usage: obj.answer_pointer_pass() and returns: list