parameters: (self)
return_statement: return kernel, recurrent_kernel, bias1, bias2
docstring: Converts Haste GRU weights to native PyTorch GRU weights.
  
      Returns:
        weight_ih_l0: Parameter, the input-hidden weights of the GRU layer.
        weight_hh_l0: Parameter, the hidden-hidden weights of the GRU layer.
        bias_ih_l0: Parameter, the input-hidden bias of the GRU layer.
        bias_hh_l0: Parameter, the hidden-hidden bias of the GRU layer.
docstring_summary: Converts Haste GRU weights to native PyTorch GRU weights.
docstring_tokens: Converts Haste GRU weights to native PyTorch GRU weights .
function: def to_native_weights(self):
      """
      Converts Haste GRU weights to native PyTorch GRU weights.
  
      Returns:
        weight_ih_l0: Parameter, the input-hidden weights of the GRU layer.
        weight_hh_l0: Parameter, the hidden-hidden weights of the GRU layer.
        bias_ih_l0: Parameter, the input-hidden bias of the GRU layer.
        bias_hh_l0: Parameter, the hidden-hidden bias of the GRU layer.
      """
      def reorder_weights(w):
        z, r, n = torch.chunk(w, 3, dim=-1)
        return torch.cat([r, z, n], dim=-1)
  
      kernel = reorder_weights(self.kernel).permute(1, 0).contiguous()
      recurrent_kernel = reorder_weights(self.recurrent_kernel).permute(1, 0).contiguous()
      bias1 = reorder_weights(self.bias).contiguous()
      bias2 = reorder_weights(self.recurrent_bias).contiguous()
  
      kernel = torch.nn.Parameter(kernel)
      recurrent_kernel = torch.nn.Parameter(recurrent_kernel)
      bias1 = torch.nn.Parameter(bias1)
      bias2 = torch.nn.Parameter(bias2)
      return kernel, recurrent_kernel, bias1, bias2
function_tokens: def to_native_weights ( self ) : def reorder_weights ( w ) : z , r , n = torch . chunk ( w , 3 , dim = - 1 ) return torch . cat ( [ r , z , n ] , dim = - 1 ) kernel = reorder_weights ( self . kernel ) . permute ( 1 , 0 ) . contiguous ( ) recurrent_kernel = reorder_weights ( self . recurrent_kernel ) . permute ( 1 , 0 ) . contiguous ( ) bias1 = reorder_weights ( self . bias ) . contiguous ( ) bias2 = reorder_weights ( self . recurrent_bias ) . contiguous ( ) kernel = torch . nn . Parameter ( kernel ) recurrent_kernel = torch . nn . Parameter ( recurrent_kernel ) bias1 = torch . nn . Parameter ( bias1 ) bias2 = torch . nn . Parameter ( bias2 ) return kernel , recurrent_kernel , bias1 , bias2