original_docstring: Implements forward computation of the model.
          Input Args and outputs are in the same format as torch.nn.GRU cell.
          
          Args:
              input of shape (seq_len, batch, input_size): 
              tensor containing the features of the input sequence.
              Support for packed variable length sequence not available yet.
              
              hidden_init of shape (num_layers * num_directions, batch, hidden_size): 
              tensor containing the initial hidden state for each element in the batch. 
              Defaults to zero if not provided.
          
          Returns:
              output of shape (seq_len, batch, hidden_size): 
              tensor containing the output features h_t from the last layer of the GRU, for each t
              
              h_n of shape (num_layers, batch, hidden_size): 
              tensor containing the hidden state for t = seq_len 
          
docstring: Implements forward computation of the model.
  Input Args and outputs are in the same format as torch.nn.GRU cell.
  
  input of shape (seq_len, batch, input_size):
  tensor containing the features of the input sequence.
  Support for packed variable length sequence not available yet.
  
  hidden_init of shape (num_layers * num_directions, batch, hidden_size):
  tensor containing the initial hidden state for each element in the batch.
  Defaults to zero if not provided.
  
  output of shape (seq_len, batch, hidden_size):
  tensor containing the output features h_t from the last layer of the GRU, for each t
  
  h_n of shape (num_layers, batch, hidden_size):
  tensor containing the hidden state for t = seq_len
docstring_tokens: Implements forward computation of the model . Input Args and outputs are in the same format as torch . nn . GRU cell . input of shape ( seq_len batch input_size ) : tensor containing the features of the input sequence . Support for packed variable length sequence not available yet . hidden_init of shape ( num_layers * num_directions batch hidden_size ) : tensor containing the initial hidden state for each element in the batch . Defaults to zero if not provided . output of shape ( seq_len batch hidden_size ) : tensor containing the output features h_t from the last layer of the GRU for each t h_n of shape ( num_layers batch hidden_size ) : tensor containing the hidden state for t = seq_len
code: def forward(self, input, hidden_init=None):
          """Implements forward computation of the model.
          Input Args and outputs are in the same format as torch.nn.GRU cell.
          
          Args:
              input of shape (seq_len, batch, input_size): 
              tensor containing the features of the input sequence.
              Support for packed variable length sequence not available yet.
              
              hidden_init of shape (num_layers * num_directions, batch, hidden_size): 
              tensor containing the initial hidden state for each element in the batch. 
              Defaults to zero if not provided.
          
          Returns:
              output of shape (seq_len, batch, hidden_size): 
              tensor containing the output features h_t from the last layer of the GRU, for each t
              
              h_n of shape (num_layers, batch, hidden_size): 
              tensor containing the hidden state for t = seq_len 
          """
          batch_size = input.shape[1]
          seq_len = input.shape[0]
  
          hidden_inits = None
          if hidden_init is not None:                                  
              hidden_inits = torch.chunk(hidden_init, len(self._Cells), dim=0)
  
          self.reset_hidden(batch_size, hidden_inits)
  
          outputs = []
          for t in range(seq_len):
              outputs.append(self.step(input[t]))
          
          #output contruction
          output = torch.stack([h[-1] for h in outputs], dim=0)
  
          #h_n construction
          h_n = torch.stack([hidden["h"] for hidden in self._h_prev], dim=0)
          
          return output, h_n
code_tokens: def forward ( self , input , hidden_init = None ) : batch_size = input . shape [ 1 ] seq_len = input . shape [ 0 ] hidden_inits = None if hidden_init is not None : hidden_inits = torch . chunk ( hidden_init , len ( self . _Cells ) , dim = 0 ) self . reset_hidden ( batch_size , hidden_inits ) outputs = [ ] for t in range ( seq_len ) : outputs . append ( self . step ( input [ t ] ) ) output = torch . stack ( [ h [ - 1 ] for h in outputs ] , dim = 0 ) h_n = torch . stack ( [ hidden [ "h" ] for hidden in self . _h_prev ] , dim = 0 ) return output , h_n
short_docstring: Implements forward computation of the model.
short_docstring_tokens: Implements forward computation of the model .
comment: """Implements forward computation of the model.
          Input Args and outputs are in the same format as torch.nn.GRU cell.
          
          Args:
              input of shape (seq_len, batch, input_size): 
              tensor containing the features of the input sequence.
              Support for packed variable length sequence not available yet.
              
              hidden_init of shape (num_layers * num_directions, batch, hidden_size): 
              tensor containing the initial hidden state for each element in the batch. 
              Defaults to zero if not provided.
          
          Returns:
              output of shape (seq_len, batch, hidden_size): 
              tensor containing the output features h_t from the last layer of the GRU, for each t
              
              h_n of shape (num_layers, batch, hidden_size): 
              tensor containing the hidden state for t = seq_len 
          """$SEP$#output contruction$SEP$#h_n construction