class_docstr: The Transformer encoder from "Attention is All You Need"
  :cite:`DBLP:journals/corr/VaswaniSPUJGKP17`
  
  Args:
      num_layers (int): number of encoder layers
      d_model (int): size of the model
      heads (int): number of heads
      d_ff (int): size of the inner FF layer
      dropout (float): dropout parameters
      embeddings (onmt.modules.Embeddings):
        embeddings to use, should have positional encodings
      pos_ffn_activation_fn (ActivationFunction):
          activation function choice for PositionwiseFeedForward layer
  
  Returns:
      (torch.FloatTensor, torch.FloatTensor):
  
      * enc_out ``(batch_size, src_len, model_dim)``
      * encoder final state: None in the case of Transformer
      * src_len ``(batch_size)``
class_docstr_tok: ["The","Transformer","encoder","from","``","Attention","is","All","You","Need","''",":","cite",":","`","DBLP",":","journals\/corr\/VaswaniSPUJGKP17","`","Args",":","num_layers","(","int",")",":","number","of","encoder","layers","d_model","(","int",")",":","size","of","the","model","heads","(","int",")",":","number","of","heads","d_ff","(","int",")",":","size","of","the","inner","FF","layer","dropout","(","float",")",":","dropout","parameters","embeddings","(","onmt.modules.Embeddings",")",":","embeddings","to","use",",","should","have","positional","encodings","pos_ffn_activation_fn","(","ActivationFunction",")",":","activation","function","choice","for","PositionwiseFeedForward","layer","Returns",":","(","torch.FloatTensor",",","torch.FloatTensor",")",":","*","enc_out","``","(","batch_size",",","src_len",",","model_dim",")","``","*","encoder","final","state",":","None","in","the","case","of","Transformer","*","src_len","``","(","batch_size",")","``"]
code: def update_dropout(self, dropout, attention_dropout):
      self.embeddings.update_dropout(dropout)
      for layer in self.transformer:
          layer.update_dropout(dropout, attention_dropout)
  
file_path: OpenNMT-py/onmt/encoders/transformer.py
imports: import torch.nn
  from onmt.encoders.encoder import EncoderBase
  from onmt.modules import MultiHeadedAttention
  from onmt.modules.position_ffn import PositionwiseFeedForward
  from onmt.modules.position_ffn import ActivationFunction
  from onmt.utils.misc import sequence_mask
label_desc: Use image node_id 4 for calling the TransformerEncoder obj's underlying member method code with example usage: obj.update_dropout(dropout, attention_dropout) without return types