class_docstr: A transformer model.
  
  User is able to modify the attributes as needed. The architecture
  is based on the paper "Attention Is All You Need". Ashish Vaswani, Noam Shazeer,
  Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and
  Illia Polosukhin. 2017. Attention is all you need. In Advances in Neural Information
  Processing Systems, pages 6000-6010.
  
  Args:
      d_model: the number of expected features in the encoder/decoder inputs (default=512).
      nhead: the number of heads in the multiheadattention models (default=8).
      num_encoder_layers: the number of sub-encoder-layers in the encoder (default=6).
      num_decoder_layers: the number of sub-decoder-layers in the decoder (default=6).
      dim_feedforward: the dimension of the feedforward network model (default=2048).
      dropout: the dropout value (default=0.1).
      activation: the activation function of encoder/decoder intermediate layer, can be a string
          ("relu" or "gelu") or a unary callable. Default: relu
      custom_encoder: custom encoder (default=None).
      custom_decoder: custom decoder (default=None).
      layer_norm_eps: the eps value in layer normalization components (default=1e-5).
      batch_first: If ``True``, then the input and output tensors are provided
          as (batch, seq, feature). Default: ``False`` (seq, batch, feature).
      norm_first: if ``True``, encoder and decoder layers will perform LayerNorms before
          other attention and feedforward operations, otherwise after. Default: ``False`` (after).
      bias: If set to ``False``, ``Linear`` and ``LayerNorm`` layers will not learn an additive
          bias. Default: ``True``.
  
  Examples::
      >>> transformer_model = nn.Transformer(nhead=16, num_encoder_layers=12)
      >>> src = torch.rand((10, 32, 512))
      >>> tgt = torch.rand((20, 32, 512))
      >>> out = transformer_model(src, tgt)
  
  Note: A full example to apply nn.Transformer module for the word language model is available in
  https://github.com/pytorch/examples/tree/master/word_language_model
class_docstr_tok: ["A","transformer","model",".","User","is","able","to","modify","the","attributes","as","needed",".","The","architecture","is","based","on","the","paper","``","Attention","Is","All","You","Need","''",".","Ashish","Vaswani",",","Noam","Shazeer",",","Niki","Parmar",",","Jakob","Uszkoreit",",","Llion","Jones",",","Aidan","N","Gomez",",","Lukasz","Kaiser",",","and","Illia","Polosukhin",".","2017",".","Attention","is","all","you","need",".","In","Advances","in","Neural","Information","Processing","Systems",",","pages","6000-6010",".","Args",":","d_model",":","the","number","of","expected","features","in","the","encoder\/decoder","inputs","(","default=512",")",".","nhead",":","the","number","of","heads","in","the","multiheadattention","models","(","default=8",")",".","num_encoder_layers",":","the","number","of","sub-encoder-layers","in","the","encoder","(","default=6",")",".","num_decoder_layers",":","the","number","of","sub-decoder-layers","in","the","decoder","(","default=6",")",".","dim_feedforward",":","the","dimension","of","the","feedforward","network","model","(","default=2048",")",".","dropout",":","the","dropout","value","(","default=0.1",")",".","activation",":","the","activation","function","of","encoder\/decoder","intermediate","layer",",","can","be","a","string","(","``","relu","''","or","``","gelu","''",")","or","a","unary","callable",".","Default",":","relu","custom_encoder",":","custom","encoder","(","default=None",")",".","custom_decoder",":","custom","decoder","(","default=None",")",".","layer_norm_eps",":","the","eps","value","in","layer","normalization","components","(","default=1e-5",")",".","batch_first",":","If","``","True","``",",","then","the","input","and","output","tensors","are","provided","as","(","batch",",","seq",",","feature",")",".","Default",":","``","False","``","(","seq",",","batch",",","feature",")",".","norm_first",":","if","``","True","``",",","encoder","and","decoder","layers","will","perform","LayerNorms","before","other","attention","and","feedforward","operations",",","otherwise","after",".","Default",":","``","False","``","(","after",")",".","bias",":","If","set","to","``","False","``",",","``","Linear","``","and","``","LayerNorm","``","layers","will","not","learn","an","additive","bias",".","Default",":","``","True","``",".","Examples",":",":",">",">",">","transformer_model","=","nn.Transformer","(","nhead=16",",","num_encoder_layers=12",")",">",">",">","src","=","torch.rand","(","(","10",",","32",",","512",")",")",">",">",">","tgt","=","torch.rand","(","(","20",",","32",",","512",")",")",">",">",">","out","=","transformer_model","(","src",",","tgt",")","Note",":","A","full","example","to","apply","nn.Transformer","module","for","the","word","language","model","is","available","in","https",":","\/\/github.com\/pytorch\/examples\/tree\/master\/word_language_model"]
docstr: Initiate parameters in the transformer model.
docstr_tok: ["Initiate","parameters","in","the","transformer","model","."]
code: def _reset_parameters(self):
      r"""Initiate parameters in the transformer model."""
      for p in self.parameters():
          if p.dim() > 1:
              xavier_uniform_(p)
  
imports: import copy
  from typing import Optional, Any, Union, Callable
  import torch
  import warnings
  from torch import Tensor
  from ..None import functional
  from .module import Module
  from .activation import MultiheadAttention
  from .container import ModuleList
  from ..init import xavier_uniform_
  from .dropout import Dropout
  from .linear import Linear
  from .normalization import LayerNorm
label_desc: Use image node_id 4 for calling the Transformer obj's underlying member method code with example usage: obj._reset_parameters() without return types