class_docstr: Embedding class that loads token embedding vectors from file. Token
  embeddings not in the embedding file are initialized as specified in
  :attr:`hparams`.
  
  Args:
      vocab (dict): A dictionary that maps token strings to integer index.
      read_fn: Callable that takes `(filename, vocab, word_vecs)` and
          returns the updated `word_vecs`. E.g.,
          :func:`~texar.tf.data.embedding.load_word2vec` and
          :func:`~texar.tf.data.embedding.load_glove`.
class_docstr_tok: ["Embedding","class","that","loads","token","embedding","vectors","from","file",".","Token","embeddings","not","in","the","embedding","file","are","initialized","as","specified","in",":","attr",":","`","hparams","`",".","Args",":","vocab","(","dict",")",":","A","dictionary","that","maps","token","strings","to","integer","index",".","read_fn",":","Callable","that","takes","`","(","filename",",","vocab",",","word_vecs",")","`","and","returns","the","updated","`","word_vecs","`",".","E.g.",",",":","func",":","`","~texar.tf.data.embedding.load_word2vec","`","and",":","func",":","`","~texar.tf.data.embedding.load_glove","`","."]
docstr: Returns a dictionary of hyperparameters with default values:
  
  .. role:: python(code)
     :language: python
  
  .. code-block:: python
  
      {
          "file": "",
          "dim": 50,
          "read_fn": "load_word2vec",
          "init_fn": {
              "type": "numpy.random.uniform",
              "kwargs": {
                  "low": -0.1,
                  "high": 0.1,
              }
          },
      }
  
  Here:
  
  "file": str
      Path to the embedding file. If not provided, all embeddings are
      initialized with the initialization function.
  
  "dim": int
      Dimension size of each embedding vector
  
  "read_fn": str or callable
      Function to read the embedding file. This can be the function,
      or its string name or full module path. E.g.,
  
      .. code-block:: python
  
          "read_fn": texar.tf.data.load_word2vec
          "read_fn": "load_word2vec"
          "read_fn": "texar.tf.data.load_word2vec"
          "read_fn": "my_module.my_read_fn"
  
      If function string name is used, the function must be in
      one of the modules: :mod:`texar.tf.data` or :mod:`texar.tf.custom`.
  
      The function must have the same signature as with
      :func:`load_word2vec`.
  
  "init_fn": dict
      Hyperparameters of the initialization function used to initialize
      embedding of tokens missing in the embedding
      file.
  
      The function must accept argument named `size` or `shape` to
      specify the output shape, and return a numpy array of the shape.
  
      The `dict` has the following fields:
  
          "type": str or callable
              The initialization function. Can be either the function,
              or its string name or full module path.
  
          "kwargs": dict
              Keyword arguments for calling the function. The function
              is called with :python:`init_fn(size=[.., ..], **kwargs)`.
docstr_tok: ["Returns","a","dictionary","of","hyperparameters","with","default","values",":","..","role",":",":","python","(","code",")",":","language",":","python","..","code-block",":",":","python","{","``","file","''",":","``","''",",","``","dim","''",":","50",",","``","read_fn","''",":","``","load_word2vec","''",",","``","init_fn","''",":","{","``","type","''",":","``","numpy.random.uniform","''",",","``","kwargs","''",":","{","``","low","''",":","-0.1",",","``","high","''",":","0.1",",","}","}",",","}","Here",":","''","file","''",":","str","Path","to","the","embedding","file",".","If","not","provided",",","all","embeddings","are","initialized","with","the","initialization","function",".","``","dim","''",":","int","Dimension","size","of","each","embedding","vector","''","read_fn","''",":","str","or","callable","Function","to","read","the","embedding","file",".","This","can","be","the","function",",","or","its","string","name","or","full","module","path",".","E.g.",",","..","code-block",":",":","python","``","read_fn","''",":","texar.tf.data.load_word2vec","``","read_fn","''",":","``","load_word2vec","''","``","read_fn","''",":","``","texar.tf.data.load_word2vec","''","``","read_fn","''",":","``","my_module.my_read_fn","''","If","function","string","name","is","used",",","the","function","must","be","in","one","of","the","modules",":",":","mod",":","`","texar.tf.data","`","or",":","mod",":","`","texar.tf.custom","`",".","The","function","must","have","the","same","signature","as","with",":","func",":","`","load_word2vec","`",".","``","init_fn","''",":","dict","Hyperparameters","of","the","initialization","function","used","to","initialize","embedding","of","tokens","missing","in","the","embedding","file",".","The","function","must","accept","argument","named","`","size","`","or","`","shape","`","to","specify","the","output","shape",",","and","return","a","numpy","array","of","the","shape",".","The","`","dict","`","has","the","following","fields",":","``","type","''",":","str","or","callable","The","initialization","function",".","Can","be","either","the","function",",","or","its","string","name","or","full","module","path",".","``","kwargs","''",":","dict","Keyword","arguments","for","calling","the","function",".","The","function","is","called","with",":","python",":","`","init_fn","(","size=","[","..",",","..","]",",","*","*","kwargs",")","`","."]
code: def default_hparams():
      """Returns a dictionary of hyperparameters with default values:
  
      .. role:: python(code)
         :language: python
  
      .. code-block:: python
  
          {
              "file": "",
              "dim": 50,
              "read_fn": "load_word2vec",
              "init_fn": {
                  "type": "numpy.random.uniform",
                  "kwargs": {
                      "low": -0.1,
                      "high": 0.1,
                  }
              },
          }
  
      Here:
  
      "file": str
          Path to the embedding file. If not provided, all embeddings are
          initialized with the initialization function.
  
      "dim": int
          Dimension size of each embedding vector
  
      "read_fn": str or callable
          Function to read the embedding file. This can be the function,
          or its string name or full module path. E.g.,
  
          .. code-block:: python
  
              "read_fn": texar.tf.data.load_word2vec
              "read_fn": "load_word2vec"
              "read_fn": "texar.tf.data.load_word2vec"
              "read_fn": "my_module.my_read_fn"
  
          If function string name is used, the function must be in
          one of the modules: :mod:`texar.tf.data` or :mod:`texar.tf.custom`.
  
          The function must have the same signature as with
          :func:`load_word2vec`.
  
      "init_fn": dict
          Hyperparameters of the initialization function used to initialize
          embedding of tokens missing in the embedding
          file.
  
          The function must accept argument named `size` or `shape` to
          specify the output shape, and return a numpy array of the shape.
  
          The `dict` has the following fields:
  
              "type": str or callable
                  The initialization function. Can be either the function,
                  or its string name or full module path.
  
              "kwargs": dict
                  Keyword arguments for calling the function. The function
                  is called with :python:`init_fn(size=[.., ..], **kwargs)`.
      """
      return {
          "file": "",
          "dim": 50,
          "read_fn": "load_word2vec",
          "init_fn": {
              "type": "numpy.random.uniform",
              "kwargs": {
                  "low": -0.1,
                  "high": 0.1,
              },
          },
          "@no_typecheck": ["read_fn", "init_fn"],
      }
  
file_path: texar/texar/tf/data/embedding.py
imports: import tensorflow
  from tensorflow import gfile
  import numpy
  from texar.tf.utils import utils
  from texar.tf.hyperparams import HParams
label_desc: Use image node_id 2 for calling the Embedding obj's underlying member method code with example usage: obj.default_hparams() and returns: dict