class_docstr: Raw GPT2 Transformer for encoding sequences. Please see
  :class:`~texar.tf.modules.PretrainedGPT2Mixin` for a brief description
  of GPT2.
  
  This module basically stacks
  :class:`~texar.tf.modules.WordEmbedder`,
  :class:`~texar.tf.modules.PositionEmbedder`,
  :class:`~texar.tf.modules.TransformerEncoder`.
  
  Args:
      pretrained_model_name (optional): a `str`, the name
          of pre-trained model (e.g., ``gpt2-small``). Please refer to
          :class:`~texar.tf.modules.PretrainedGPT2Mixin` 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
          hyperparameter 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: ["Raw","GPT2","Transformer","for","encoding","sequences",".","Please","see",":","class",":","`","~texar.tf.modules.PretrainedGPT2Mixin","`","for","a","brief","description","of","GPT2",".","This","module","basically","stacks",":","class",":","`","~texar.tf.modules.WordEmbedder","`",",",":","class",":","`","~texar.tf.modules.PositionEmbedder","`",",",":","class",":","`","~texar.tf.modules.TransformerEncoder","`",".","Args",":","pretrained_model_name","(","optional",")",":","a","`","str","`",",","the","name","of","pre-trained","model","(","e.g.",",","``","gpt2-small","``",")",".","Please","refer","to",":","class",":","`","~texar.tf.modules.PretrainedGPT2Mixin","`","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","hyperparameter","will","be","set","to","default","values",".","See",":","meth",":","`","default_hparams","`","for","the","hyperparameter","structure","and","default","values",".","..","document","private","functions","..","automethod",":",":","_build"]
code: def reset_parameters(self):
      with tf.variable_scope(self.variable_scope):
          if self._hparams.initializer:
              tf.get_variable_scope().set_initializer(
                  get_initializer(self._hparams.initializer)
              )
  
file_path: texar/texar/tf/modules/encoders/gpt2_encoder.py
imports: from typing import Optional
  import tensorflow
  from texar.tf.core.layers import get_initializer
  from texar.tf.modules.embedders.embedders import WordEmbedder
  from texar.tf.modules.embedders.position_embedders import PositionEmbedder
  from texar.tf.modules.encoders.encoder_base import EncoderBase
  from texar.tf.modules.encoders.transformer_encoders import TransformerEncoder
  from texar.tf.modules.pretrained.gpt2 import PretrainedGPT2Mixin
label_desc: Use image node_id 2 for calling the GPT2Encoder obj's underlying member method code with example usage: obj.reset_parameters() without return types