code: def position_encoding(sentence_size, embedding_size):
      """
      Position Encoding described in section 4.1 of
      End-To-End Memory Networks (https://arxiv.org/abs/1503.08895).
  
      Args:
        sentence_size: length of the sentence
        embedding_size: dimensionality of the embeddings
  
      Returns:
        A numpy array of shape [sentence_size, embedding_size] containing
        the fixed position encodings for each sentence position.
      """
      encoding = np.ones(
          (sentence_size, embedding_size), dtype=np.float32
      )
      ls = sentence_size + 1
      le = embedding_size + 1
      for k in range(1, le):
          for j in range(1, ls):
              encoding[j - 1, k - 1] = (1.0 - j / float(ls)) - (
                  k / float(le)
              ) * (1.0 - 2.0 * j / float(ls))
      return encoding
  
file_path: seq2seq/seq2seq/encoders/pooling_encoder.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from pydoc import locate
  import numpy
  import tensorflow
  from seq2seq.encoders.encoder import Encoder, EncoderOutput
label_desc: Use image node_id 1 for calling a global function with example usage: position_encoding(sentence_size, embedding_size) and returns: encoding