class_docstr: Regressor based on XLNet modules. Please see
  :class:`~texar.tf.modules.PretrainedXLNetMixin` for a brief description
  of XLNet.
  
  This is a combination of the :class:`~texar.tf.modules.XLNetEncoder` with a
  classification layer. Both step-wise classification and sequence-level
  classification are supported, specified in :attr:`hparams`.
  
  Arguments are the same as in :class:`~texar.tf.modules.XLNetEncoder`.
  
  Args:
      pretrained_model_name (optional): a `str`, the name
          of pre-trained model (e.g., ``xlnet-based-cased``). Please refer to
          :class:`~texar.tf.modules.PretrainedXLNetMixin` for
          all supported models.
          If `None`, the model name in :attr:`hparams` is used.
      cache_dir (optional): the path to a folder in which the
          pre-trained models will be cached. If `None` (default),
          a default directory (``texar_data`` folder under user's home
          directory) will be used.
      hparams (dict or HParams, optional): Hyperparameters. Missing
          hyperparameters will be set to default values. See
          :meth:`default_hparams` for the hyperparameter structure
          and default values.
  
  .. document private functions
  .. automethod:: _build
class_docstr_tok: ["Regressor","based","on","XLNet","modules",".","Please","see",":","class",":","`","~texar.tf.modules.PretrainedXLNetMixin","`","for","a","brief","description","of","XLNet",".","This","is","a","combination","of","the",":","class",":","`","~texar.tf.modules.XLNetEncoder","`","with","a","classification","layer",".","Both","step-wise","classification","and","sequence-level","classification","are","supported",",","specified","in",":","attr",":","`","hparams","`",".","Arguments","are","the","same","as","in",":","class",":","`","~texar.tf.modules.XLNetEncoder","`",".","Args",":","pretrained_model_name","(","optional",")",":","a","`","str","`",",","the","name","of","pre-trained","model","(","e.g.",",","``","xlnet-based-cased","``",")",".","Please","refer","to",":","class",":","`","~texar.tf.modules.PretrainedXLNetMixin","`","for","all","supported","models",".","If","`","None","`",",","the","model","name","in",":","attr",":","`","hparams","`","is","used",".","cache_dir","(","optional",")",":","the","path","to","a","folder","in","which","the","pre-trained","models","will","be","cached",".","If","`","None","`","(","default",")",",","a","default","directory","(","``","texar_data","``","folder","under","user","'s","home","directory",")","will","be","used",".","hparams","(","dict","or","HParams",",","optional",")",":","Hyperparameters",".","Missing","hyperparameters","will","be","set","to","default","values",".","See",":","meth",":","`","default_hparams","`","for","the","hyperparameter","structure","and","default","values",".","..","document","private","functions","..","automethod",":",":","_build"]
docstr: Returns a dictionary of hyperparameters with default values.
  
  .. code-block:: python
  
      {
          # (1) Same hyperparameters as in XLNetEncoder
          ...
          # (2) Additional hyperparameters
          "regr_strategy": "cls_time",
          "use_projection": True,
          "logit_layer_kwargs": None,
          "name": "xlnet_regressor",
      }
  
  Here:
  
  1. Same hyperparameters as in
     :class:`~texar.tf.modules.XLNetEncoder`.
     See the :meth:`~texar.tf.modules.XLNetEncoder.default_hparams`.
     An instance of XLNetEncoder is created for feature extraction.
  
  2. Additional hyperparameters:
  
      `"regr_strategy"`: str
          The regression strategy, one of:
  
          - **cls_time**: Sequence-level regression based on the
            output of the first time step (which is the `CLS` token).
            Each sequence has a prediction.
          - **all_time**: Sequence-level regression based on
            the output of all time steps. Each sequence has a prediction.
          - **time_wise**: Step-wise regression, i.e., make
            regression for each time step based on its output.
  
      `"logit_layer_kwargs"` : dict
          Keyword arguments for the logit Dense layer constructor,
          except for argument "units" which is set to "num_classes".
          Ignored if no extra logit layer is appended.
  
      `"use_projection"`: bool
          If `True`, an additional dense layer is added after
          the summary step.
  
      `"name"`: str
          Name of the regressor.
docstr_tok: ["Returns","a","dictionary","of","hyperparameters","with","default","values",".","..","code-block",":",":","python","{","#","(","1",")","Same","hyperparameters","as","in","XLNetEncoder","...","#","(","2",")","Additional","hyperparameters","``","regr_strategy","''",":","``","cls_time","''",",","``","use_projection","''",":","True",",","``","logit_layer_kwargs","''",":","None",",","``","name","''",":","``","xlnet_regressor","''",",","}","Here",":","1",".","Same","hyperparameters","as","in",":","class",":","`","~texar.tf.modules.XLNetEncoder","`",".","See","the",":","meth",":","`","~texar.tf.modules.XLNetEncoder.default_hparams","`",".","An","instance","of","XLNetEncoder","is","created","for","feature","extraction",".","2",".","Additional","hyperparameters",":","`","``","regr_strategy","''","`",":","str","The","regression","strategy",",","one","of",":","-","*","*","cls_time","*","*",":","Sequence-level","regression","based","on","the","output","of","the","first","time","step","(","which","is","the","`","CLS","`","token",")",".","Each","sequence","has","a","prediction",".","-","*","*","all_time","*","*",":","Sequence-level","regression","based","on","the","output","of","all","time","steps",".","Each","sequence","has","a","prediction",".","-","*","*","time_wise","*","*",":","Step-wise","regression",",","i.e.",",","make","regression","for","each","time","step","based","on","its","output",".","`","``","logit_layer_kwargs","''","`",":","dict","Keyword","arguments","for","the","logit","Dense","layer","constructor",",","except","for","argument","``","units","''","which","is","set","to","``","num_classes","''",".","Ignored","if","no","extra","logit","layer","is","appended",".","`","``","use_projection","''","`",":","bool","If","`","True","`",",","an","additional","dense","layer","is","added","after","the","summary","step",".","`","``","name","''","`",":","str","Name","of","the","regressor","."]
code: def default_hparams():
      r"""Returns a dictionary of hyperparameters with default values.
  
      .. code-block:: python
  
          {
              # (1) Same hyperparameters as in XLNetEncoder
              ...
              # (2) Additional hyperparameters
              "regr_strategy": "cls_time",
              "use_projection": True,
              "logit_layer_kwargs": None,
              "name": "xlnet_regressor",
          }
  
      Here:
  
      1. Same hyperparameters as in
         :class:`~texar.tf.modules.XLNetEncoder`.
         See the :meth:`~texar.tf.modules.XLNetEncoder.default_hparams`.
         An instance of XLNetEncoder is created for feature extraction.
  
      2. Additional hyperparameters:
  
          `"regr_strategy"`: str
              The regression strategy, one of:
  
              - **cls_time**: Sequence-level regression based on the
                output of the first time step (which is the `CLS` token).
                Each sequence has a prediction.
              - **all_time**: Sequence-level regression based on
                the output of all time steps. Each sequence has a prediction.
              - **time_wise**: Step-wise regression, i.e., make
                regression for each time step based on its output.
  
          `"logit_layer_kwargs"` : dict
              Keyword arguments for the logit Dense layer constructor,
              except for argument "units" which is set to "num_classes".
              Ignored if no extra logit layer is appended.
  
          `"use_projection"`: bool
              If `True`, an additional dense layer is added after
              the summary step.
  
          `"name"`: str
              Name of the regressor.
      """
      hparams = XLNetEncoder.default_hparams()
      hparams.update(
          {
              "logit_layer_kwargs": None,
              "regr_strategy": "cls_time",
              "dropout": 0.1,
              "use_projection": True,
              "name": "xlnet_regressor",
          }
      )
      return hparams
  
file_path: texar/texar/tf/modules/regressors/xlnet_regressor.py
imports: import tensorflow
  from texar.tf.utils.mode import is_train_mode
  from texar.tf.core.layers import get_layer, get_initializer
  from texar.tf.modules.regressors.regressor_base import RegressorBase
  from texar.tf.modules.encoders.xlnet_encoder import XLNetEncoder
  from texar.tf.hyperparams import HParams
  from texar.tf.modules.pretrained.xlnet import PretrainedXLNetMixin
  from texar.tf.utils.utils import dict_fetch
label_desc: Use image node_id 2 for calling the XLNetRegressor obj's underlying member method code with example usage: obj.default_hparams() and returns: hparams