class_docstr: Simple position embedder that maps position indexes into embeddings
  via lookup.
  
  Either :attr:`init_value` or :attr:`position_size` is required. If both are
  given, there must be ``init_value.shape[0]==position_size``.
  
  Args:
      init_value (optional): A Tensor or numpy array that contains the
          initial value of embeddings. It is typically of shape
          ``[position_size, embedding dim]``
  
          If `None`, embedding is initialized as specified in
          ``hparams["initializer"]``. Otherwise, the
          ``"initializer"`` and ``"dim"``
          hyperparameters in :attr:`hparams` are ignored.
      position_size (int, optional): The number of possible positions, e.g.,
          the maximum sequence length. Required if :attr:`init_value` is
          not given.
      hparams (dict, optional): Embedder hyperparameters. If it is not
          specified, the default hyperparameter setting is used. See
          :attr:`default_hparams` for the structure and default values.
  
  
  .. document private functions
  .. automethod:: _build
class_docstr_tok: ["Simple","position","embedder","that","maps","position","indexes","into","embeddings","via","lookup",".","Either",":","attr",":","`","init_value","`","or",":","attr",":","`","position_size","`","is","required",".","If","both","are","given",",","there","must","be","``","init_value.shape","[","0","]","==position_size","``",".","Args",":","init_value","(","optional",")",":","A","Tensor","or","numpy","array","that","contains","the","initial","value","of","embeddings",".","It","is","typically","of","shape","``","[","position_size",",","embedding","dim","]","``","If","`","None","`",",","embedding","is","initialized","as","specified","in","``","hparams","[","``","initializer","''","]","``",".","Otherwise",",","the","``","``","initializer","''","``","and","``","``","dim","''","``","hyperparameters","in",":","attr",":","`","hparams","`","are","ignored",".","position_size","(","int",",","optional",")",":","The","number","of","possible","positions",",","e.g.",",","the","maximum","sequence","length",".","Required","if",":","attr",":","`","init_value","`","is","not","given",".","hparams","(","dict",",","optional",")",":","Embedder","hyperparameters",".","If","it","is","not","specified",",","the","default","hyperparameter","setting","is","used",".","See",":","attr",":","`","default_hparams","`","for","the","structure","and","default","values",".","..","document","private","functions","..","automethod",":",":","_build"]
docstr: Returns a dictionary of hyperparameters with default values.
  
  .. code-block:: python
  
      {
          "dim": 100,
          "initializer": {
              "type": "random_uniform_initializer",
              "kwargs": {
                  "minval": -0.1,
                  "maxval": 0.1,
                  "seed": None
              }
          },
          "regularizer": {
              "type": "L1L2",
              "kwargs": {
                  "l1": 0.,
                  "l2": 0.
              }
          },
          "dropout_rate": 0,
          "trainable": True,
          "name": "position_embedder"
      }
  
  The hyperparameters have the same meaning as those in
  :meth:`texar.tf.modules.WordEmbedder.default_hparams`.
docstr_tok: ["Returns","a","dictionary","of","hyperparameters","with","default","values",".","..","code-block",":",":","python","{","``","dim","''",":","100",",","``","initializer","''",":","{","``","type","''",":","``","random_uniform_initializer","''",",","``","kwargs","''",":","{","``","minval","''",":","-0.1",",","``","maxval","''",":","0.1",",","``","seed","''",":","None","}","}",",","``","regularizer","''",":","{","``","type","''",":","``","L1L2","''",",","``","kwargs","''",":","{","``","l1","''",":","0.",",","``","l2","''",":","0.","}","}",",","``","dropout_rate","''",":","0",",","``","trainable","''",":","True",",","``","name","''",":","``","position_embedder","''","}","The","hyperparameters","have","the","same","meaning","as","those","in",":","meth",":","`","texar.tf.modules.WordEmbedder.default_hparams","`","."]
code: def default_hparams():
      r"""Returns a dictionary of hyperparameters with default values.
  
      .. code-block:: python
  
          {
              "dim": 100,
              "initializer": {
                  "type": "random_uniform_initializer",
                  "kwargs": {
                      "minval": -0.1,
                      "maxval": 0.1,
                      "seed": None
                  }
              },
              "regularizer": {
                  "type": "L1L2",
                  "kwargs": {
                      "l1": 0.,
                      "l2": 0.
                  }
              },
              "dropout_rate": 0,
              "trainable": True,
              "name": "position_embedder"
          }
  
      The hyperparameters have the same meaning as those in
      :meth:`texar.tf.modules.WordEmbedder.default_hparams`.
      """
      hparams = embedder_utils.default_embedding_hparams()
      hparams["name"] = "position_embedder"
      return hparams
  
imports: import math
  import tensorflow
  from texar.tf.modules.embedders.embedder_base import EmbedderBase
  from texar.tf.modules.embedders import embedder_utils
  from texar.tf.utils.mode import is_train_mode
  from texar.tf.utils.shapes import mask_sequences
  from texar.tf.utils.shapes import shape_list
label_desc: Use image node_id 2 for calling the PositionEmbedder obj's underlying member method code with example usage: obj.default_hparams() and returns: hparams