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
code: def __init__(
      self, encoder_major=None, encoder_minor=None, hparams=None
  ):
      EncoderBase.__init__(self, hparams)
  
      encoder_major_hparams = utils.get_instance_kwargs(
          None, self._hparams.encoder_major_hparams
      )
      encoder_minor_hparams = utils.get_instance_kwargs(
          None, self._hparams.encoder_minor_hparams
      )
  
      if encoder_major is not None:
          self._encoder_major = encoder_major
      else:
          with tf.variable_scope(self.variable_scope.name):
              with tf.variable_scope("encoder_major"):
                  self._encoder_major = utils.check_or_get_instance(
                      self._hparams.encoder_major_type,
                      encoder_major_hparams,
                      ["texar.tf.modules.encoders", "texar.tf.custom"],
                  )
  
      if encoder_minor is not None:
          self._encoder_minor = encoder_minor
      elif self._hparams.config_share:
          with tf.variable_scope(self.variable_scope.name):
              with tf.variable_scope("encoder_minor"):
                  self._encoder_minor = utils.check_or_get_instance(
                      self._hparams.encoder_major_type,
                      encoder_major_hparams,
                      ["texar.tf.modules.encoders", "texar.tf.custom"],
                  )
      else:
          with tf.variable_scope(self.variable_scope.name):
              with tf.variable_scope("encoder_minor"):
                  self._encoder_minor = utils.check_or_get_instance(
                      self._hparams.encoder_minor_type,
                      encoder_minor_hparams,
                      ["texar.tf.modules.encoders", "texar.tf.custom"],
                  )
  
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 1 to create a new HierarchicalRNNEncoder object from inherited base classes: EncoderBase with example: obj = HierarchicalRNNEncoder(encoder_major, encoder_minor, hparams)