class_docstr: A hierarchical encoder that stacks basic RNN encoders into two layers.
  Can be used to encode long, structured sequences, e.g. paragraphs, dialog
  history, etc.
  
  Args:
      encoder_major (optional): An instance of subclass of
          :class:`~texar.tf.modules.RNNEncoderBase`
          The high-level encoder taking final
          states from low-level encoder as its
          inputs. If not specified, an encoder
          is created as specified in
          :attr:`hparams["encoder_major"]`.
      encoder_minor (optional): An instance of subclass of
          :class:`~texar.tf.modules.RNNEncoderBase`
          The low-level encoder. If not
          specified, an encoder is created as specified
          in :attr:`hparams["encoder_minor"]`.
      hparams (dict or HParams, optional): Hyperparameters. Missing
          hyperparamerter will be set to default values. See
          :meth:`default_hparams` for the hyperparameter sturcture and
          default values.
  
  See :meth:`_build` for the inputs and outputs of the encoder.
  
  .. document private functions
  .. automethod:: _build
docstr: Returns a dictionary of hyperparameters with default values.
  
  .. role:: python(code)
     :language: python
  
  .. code-block:: python
  
      {
          "encoder_major_type": "UnidirectionalRNNEncoder",
          "encoder_major_hparams": {},
          "encoder_minor_type": "UnidirectionalRNNEncoder",
          "encoder_minor_hparams": {},
          "config_share": False,
          "name": "hierarchical_encoder_wrapper"
      }
  
  Here:
  
  "encoder_major_type": str or class or instance
      The high-level encoder. Can be a RNN encoder class, its name or
      module path, or a class instance.
      Ignored if `encoder_major` is given to the encoder constructor.
  
  "encoder_major_hparams": dict
      The hyperparameters for the high-level encoder. The high-level
      encoder is created with
      :python:`encoder_class(hparams=encoder_major_hparams)`.
      Ignored if `encoder_major` is given to the encoder constructor,
      or if "encoder_major_type" is an encoder instance.
  
  "encoder_minor_type": str or class or instance
      The low-level encoder. Can be a RNN encoder class, its name or
      module path, or a class instance.
      Ignored if `encoder_minor` is given to the encoder constructor,
      or if "config_share" is True.
  
  "encoder_minor_hparams": dict
      The hyperparameters for the low-level encoder. The high-level
      encoder is created with
      :python:`encoder_class(hparams=encoder_minor_hparams)`.
      Ignored if `encoder_minor` is given to the encoder constructor,
      or if "config_share" is True,
      or if "encoder_minor_type" is an encoder instance.
  
  "config_share":
      Whether to use encoder_major's hyperparameters
      to construct encoder_minor.
  
  "name":
      Name of the encoder.
docstr_tok: ["Returns","a","dictionary","of","hyperparameters","with","default","values",".","..","role",":",":","python","(","code",")",":","language",":","python","..","code-block",":",":","python","{","``","encoder_major_type","''",":","``","UnidirectionalRNNEncoder","''",",","``","encoder_major_hparams","''",":","{","}",",","``","encoder_minor_type","''",":","``","UnidirectionalRNNEncoder","''",",","``","encoder_minor_hparams","''",":","{","}",",","``","config_share","''",":","False",",","``","name","''",":","``","hierarchical_encoder_wrapper","''","}","Here",":","''","encoder_major_type","''",":","str","or","class","or","instance","The","high-level","encoder",".","Can","be","a","RNN","encoder","class",",","its","name","or","module","path",",","or","a","class","instance",".","Ignored","if","`","encoder_major","`","is","given","to","the","encoder","constructor",".","``","encoder_major_hparams","''",":","dict","The","hyperparameters","for","the","high-level","encoder",".","The","high-level","encoder","is","created","with",":","python",":","`","encoder_class","(","hparams=encoder_major_hparams",")","`",".","Ignored","if","`","encoder_major","`","is","given","to","the","encoder","constructor",",","or","if","``","encoder_major_type","''","is","an","encoder","instance",".","``","encoder_minor_type","''",":","str","or","class","or","instance","The","low-level","encoder",".","Can","be","a","RNN","encoder","class",",","its","name","or","module","path",",","or","a","class","instance",".","Ignored","if","`","encoder_minor","`","is","given","to","the","encoder","constructor",",","or","if","``","config_share","''","is","True",".","``","encoder_minor_hparams","''",":","dict","The","hyperparameters","for","the","low-level","encoder",".","The","high-level","encoder","is","created","with",":","python",":","`","encoder_class","(","hparams=encoder_minor_hparams",")","`",".","Ignored","if","`","encoder_minor","`","is","given","to","the","encoder","constructor",",","or","if","``","config_share","''","is","True",",","or","if","``","encoder_minor_type","''","is","an","encoder","instance",".","``","config_share","''",":","Whether","to","use","encoder_major","'s","hyperparameters","to","construct","encoder_minor",".","``","name","''",":","Name","of","the","encoder","."]
code: def default_hparams():
      """Returns a dictionary of hyperparameters with default values.
  
      .. role:: python(code)
         :language: python
  
      .. code-block:: python
  
          {
              "encoder_major_type": "UnidirectionalRNNEncoder",
              "encoder_major_hparams": {},
              "encoder_minor_type": "UnidirectionalRNNEncoder",
              "encoder_minor_hparams": {},
              "config_share": False,
              "name": "hierarchical_encoder_wrapper"
          }
  
      Here:
  
      "encoder_major_type": str or class or instance
          The high-level encoder. Can be a RNN encoder class, its name or
          module path, or a class instance.
          Ignored if `encoder_major` is given to the encoder constructor.
  
      "encoder_major_hparams": dict
          The hyperparameters for the high-level encoder. The high-level
          encoder is created with
          :python:`encoder_class(hparams=encoder_major_hparams)`.
          Ignored if `encoder_major` is given to the encoder constructor,
          or if "encoder_major_type" is an encoder instance.
  
      "encoder_minor_type": str or class or instance
          The low-level encoder. Can be a RNN encoder class, its name or
          module path, or a class instance.
          Ignored if `encoder_minor` is given to the encoder constructor,
          or if "config_share" is True.
  
      "encoder_minor_hparams": dict
          The hyperparameters for the low-level encoder. The high-level
          encoder is created with
          :python:`encoder_class(hparams=encoder_minor_hparams)`.
          Ignored if `encoder_minor` is given to the encoder constructor,
          or if "config_share" is True,
          or if "encoder_minor_type" is an encoder instance.
  
      "config_share":
          Whether to use encoder_major's hyperparameters
          to construct encoder_minor.
  
      "name":
          Name of the encoder.
      """
      hparams = {
          "name": "hierarchical_encoder",
          "encoder_major_type": "UnidirectionalRNNEncoder",
          "encoder_major_hparams": {},
          "encoder_minor_type": "UnidirectionalRNNEncoder",
          "encoder_minor_hparams": {},
          "config_share": False,
          "@no_typecheck": [
              "encoder_major_hparams",
              "encoder_minor_hparams",
          ],
      }
      hparams.update(EncoderBase.default_hparams())
      return hparams
  
file_path: texar/texar/tf/modules/encoders/hierarchical_encoders.py
imports: import collections
  import tensorflow
  from tensorflow.contrib.rnn import LSTMStateTuple
  from tensorflow.python.util import nest
  from texar.tf.modules.encoders.encoder_base import EncoderBase
  from texar.tf.utils import utils
label_desc: Use image node_id 2 for calling the HierarchicalRNNEncoder obj's underlying member method code with example usage: obj.default_hparams() and returns: hparams