class_docstr: This module is the basic transformer stack.
  Details in the paper:
  [BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding, Devlin et al, 2019]
  (https://api.semanticscholar.org/CorpusID:52967399)
  
  # Parameters
  
  num_hidden_layers : `int`
  layer : `TransformerLayer`, optional
  hidden_size : `int`, optional
      This needs to be provided if no `layer` argument is passed.
  intermediate_size : `int`, optional
      This needs to be provided if no `layer` argument is passed.
  num_attention_heads : `int`
  attention_dropout : `float` (default = `0.0`)
      Dropout probability for the `SelfAttention` layer.
  hidden_dropout : `float` (default = `0.0`)
      Dropout probability for the `OutputLayer`.
  activation : `Union[str, torch.nn.Module]` (default = `"relu"`)
  add_cross_attention: `bool` (default = `False`)
      If True, the `TransformerLayer` modules will have cross attention modules as well.
      This is helpful when using the `TransformerStack` as a decoder.
class_docstr_tok: ["This","module","is","the","basic","transformer","stack",".","Details","in","the","paper",":","[","BERT",":","Pre-training","of","Deep","Bidirectional","Transformers","for","Language","Understanding",",","Devlin","et","al",",","2019","]","(","https",":","\/\/api.semanticscholar.org\/CorpusID:52967399",")","#","Parameters","num_hidden_layers",":","`","int","`","layer",":","`","TransformerLayer","`",",","optional","hidden_size",":","`","int","`",",","optional","This","needs","to","be","provided","if","no","`","layer","`","argument","is","passed",".","intermediate_size",":","`","int","`",",","optional","This","needs","to","be","provided","if","no","`","layer","`","argument","is","passed",".","num_attention_heads",":","`","int","`","attention_dropout",":","`","float","`","(","default","=","`","0.0","`",")","Dropout","probability","for","the","`","SelfAttention","`","layer",".","hidden_dropout",":","`","float","`","(","default","=","`","0.0","`",")","Dropout","probability","for","the","`","OutputLayer","`",".","activation",":","`","Union","[","str",",","torch.nn.Module","]","`","(","default","=","`","``","relu","''","`",")","add_cross_attention",":","`","bool","`","(","default","=","`","False","`",")","If","True",",","the","`","TransformerLayer","`","modules","will","have","cross","attention","modules","as","well",".","This","is","helpful","when","using","the","`","TransformerStack","`","as","a","decoder","."]
code: def get_output_dim(self) -> int:
      return self.layers[-1].get_output_dim()
  
file_path: allennlp/allennlp/modules/transformer/transformer_stack.py
imports: from typing import Union, Optional, Tuple, TYPE_CHECKING
  import logging
  from dataclasses import dataclass
  import torch
  from allennlp.common import FromParams
  from allennlp.modules.util import replicate_layers
  from allennlp.modules.transformer.transformer_layer import TransformerLayer
  from allennlp.modules.transformer.transformer_module import TransformerModule
  from allennlp.modules.transformer.util import FloatT
label_desc: Use image node_id 2 for calling the TransformerStack obj's underlying member method code with example usage: obj.get_output_dim() and returns: self