class_docstr: The Stack LSTM from Dyer et al: https://arxiv.org/abs/1505.08075
class_docstr_tok: ["The","Stack","LSTM","from","Dyer","et","al",":","https",":","\/\/arxiv.org\/abs\/1505.08075"]
docstr: Shapes:
      initial_state: (lstm_layers, 1, lstm_hidden_dim) each
docstr_tok: ["Shapes",":","initial_state",":","(","lstm_layers",",","1",",","lstm_hidden_dim",")","each"]
code: def __init__(self, lstm: nn.LSTM):
      """
      Shapes:
          initial_state: (lstm_layers, 1, lstm_hidden_dim) each
      """
      self.lstm = lstm
      initial_state = (
          FloatTensor(lstm.num_layers, 1, lstm.hidden_size).fill_(0),
          FloatTensor(lstm.num_layers, 1, lstm.hidden_size).fill_(0),
      )
      # Stack of (state, (embedding, element))
      self.stack = [
          (
              initial_state,
              (self._lstm_output(initial_state), Element("Root")),
          )
      ]
  
imports: from typing import Any, List, Sized, Tuple
  import torch
  import torch.nn
  from pytext.torchscript.utils import reverse_tensor_list
  from pytext.utils.cuda import FloatTensor
  from pytext.utils.tensor import xaviervar
label_desc: Use image node_id 1 to create a new StackLSTM object from inherited base classes: Sized with example: obj = StackLSTM(lstm)