class_docstr: Pytorch's RNNs have two outputs: the hidden state for every time step, and the hidden state at
  the last time step for every layer.  We just want the first one as a single output.  This
  wrapper pulls out that output, and adds a `get_output_dim` method, which is useful if you
  want to, e.g., define a linear + softmax layer on top of this to get some distribution over a
  set of labels.  The linear layer needs to know its input dimension before it is called, and you
  can get that from `get_output_dim`.
  
  In order to be wrapped with this wrapper, a class must have the following members:
  
      - `self.input_size: int`
      - `self.hidden_size: int`
      - `def forward(inputs: PackedSequence, hidden_state: torch.Tensor) ->
        Tuple[PackedSequence, torch.Tensor]`.
      - `self.bidirectional: bool` (optional)
  
  This is what pytorch's RNN's look like - just make sure your class looks like those, and it
  should work.
  
  Note that we *require* you to pass a binary mask of shape (batch_size, sequence_length)
  when you call this module, to avoid subtle bugs around masking.  If you already have a
  `PackedSequence` you can pass `None` as the second parameter.
  
  We support stateful RNNs where the final state from each batch is used as the initial
  state for the subsequent batch by passing `stateful=True` to the constructor.
code: def is_bidirectional(self) -> bool:
      return self._is_bidirectional
  
imports: import torch
  from torch.nn.utils.rnn import pad_packed_sequence
  from allennlp.common.checks import ConfigurationError
  from allennlp.modules.augmented_lstm import AugmentedLstm
  from allennlp.modules.seq2seq_encoders.seq2seq_encoder import Seq2SeqEncoder
  from allennlp.modules.stacked_alternating_lstm import StackedAlternatingLstm
  from allennlp.modules.stacked_bidirectional_lstm import StackedBidirectionalLstm
label_desc: Use image node_id 4 for calling the PytorchSeq2SeqWrapper obj's underlying member method code with example usage: obj.is_bidirectional() and returns: self