class_docstr: Implementation of "Training RNNs as Fast as CNNs"
  :cite:`DBLP:journals/corr/abs-1709-02755`
  
  TODO: turn to pytorch's implementation when it is available.
  
  This implementation is adpoted from the author of the paper:
  https://github.com/taolei87/sru/blob/master/cuda_functional.py.
  
  Args:
    input_size (int): input to model
    hidden_size (int): hidden dimension
    num_layers (int): number of layers
    dropout (float): dropout to use (stacked)
    rnn_dropout (float): dropout to use (recurrent)
    bidirectional (bool): bidirectional
    use_tanh (bool): activation
    use_relu (bool): activation
class_docstr_tok: ["Implementation","of","``","Training","RNNs","as","Fast","as","CNNs","''",":","cite",":","`","DBLP",":","journals\/corr\/abs-1709-02755","`","TODO",":","turn","to","pytorch","'s","implementation","when","it","is","available",".","This","implementation","is","adpoted","from","the","author","of","the","paper",":","https",":","\/\/github.com\/taolei87\/sru\/blob\/master\/cuda_functional.py",".","Args",":","input_size","(","int",")",":","input","to","model","hidden_size","(","int",")",":","hidden","dimension","num_layers","(","int",")",":","number","of","layers","dropout","(","float",")",":","dropout","to","use","(","stacked",")","rnn_dropout","(","float",")",":","dropout","to","use","(","recurrent",")","bidirectional","(","bool",")",":","bidirectional","use_tanh","(","bool",")",":","activation","use_relu","(","bool",")",":","activation"]
code: def __init__(
      self,
      input_size,
      hidden_size,
      num_layers=2,
      dropout=0,
      rnn_dropout=0,
      bidirectional=False,
      use_tanh=1,
      use_relu=0,
  ):
      # An entry check here, will catch on train side and translate side
      # if requirements are not satisfied.
      check_sru_requirement(abort=True)
      super(SRU, self).__init__()
      self.n_in = input_size
      self.n_out = hidden_size
      self.depth = num_layers
      self.dropout = dropout
      self.rnn_dropout = rnn_dropout
      self.rnn_lst = nn.ModuleList()
      self.bidirectional = bidirectional
      self.out_size = hidden_size * 2 if bidirectional else hidden_size
  
      for i in range(num_layers):
          sru_cell = SRUCell(
              n_in=self.n_in if i == 0 else self.out_size,
              n_out=self.n_out,
              dropout=dropout if i + 1 != num_layers else 0,
              rnn_dropout=rnn_dropout,
              bidirectional=bidirectional,
              use_tanh=use_tanh,
              use_relu=use_relu,
          )
          self.rnn_lst.append(sru_cell)
  
imports: import subprocess
  import platform
  import os
  import re
  import configargparse
  import torch
  import torch.nn
  from torch.autograd import Function
  from torch.cuda.amp import custom_fwd, custom_bwd
  from collections import namedtuple
label_desc: Use image node_id 1 to create a new SRU object from inherited base classes: nn with example: obj = SRU(input_size, hidden_size, num_layers, dropout, rnn_dropout, bidirectional, use_tanh, use_relu)