parameters: (self)
return_statement: return kernel, recurrent_kernel, bias1, bias2
docstring: Converts Haste LSTM weights to native PyTorch LSTM weights.
  
      Returns:
        weight_ih_l0: Parameter, the input-hidden weights of the LSTM layer.
        weight_hh_l0: Parameter, the hidden-hidden weights of the LSTM layer.
        bias_ih_l0: Parameter, the input-hidden bias of the LSTM layer.
        bias_hh_l0: Parameter, the hidden-hidden bias of the LSTM layer.
docstring_summary: Converts Haste LSTM weights to native PyTorch LSTM weights.
docstring_tokens: Converts Haste LSTM weights to native PyTorch LSTM weights .
function: def to_native_weights(self):
      """
      Converts Haste LSTM weights to native PyTorch LSTM weights.
  
      Returns:
        weight_ih_l0: Parameter, the input-hidden weights of the LSTM layer.
        weight_hh_l0: Parameter, the hidden-hidden weights of the LSTM layer.
        bias_ih_l0: Parameter, the input-hidden bias of the LSTM layer.
        bias_hh_l0: Parameter, the hidden-hidden bias of the LSTM layer.
      """
      def reorder_weights(w):
        i, g, f, o = torch.chunk(w, 4, dim=-1)
        return torch.cat([i, f, g, o], dim=-1)
      kernel = reorder_weights(self.kernel).permute(1, 0).contiguous()
      recurrent_kernel = reorder_weights(self.recurrent_kernel).permute(1, 0).contiguous()
      half_bias = reorder_weights(self.bias) / 2.0
  
      kernel = torch.nn.Parameter(kernel)
      recurrent_kernel = torch.nn.Parameter(recurrent_kernel)
      bias1 = torch.nn.Parameter(half_bias)
      bias2 = torch.nn.Parameter(half_bias.clone())
      return kernel, recurrent_kernel, bias1, bias2
function_tokens: def to_native_weights ( self ) : def reorder_weights ( w ) : i , g , f , o = torch . chunk ( w , 4 , dim = - 1 ) return torch . cat ( [ i , f , g , o ] , dim = - 1 ) kernel = reorder_weights ( self . kernel ) . permute ( 1 , 0 ) . contiguous ( ) recurrent_kernel = reorder_weights ( self . recurrent_kernel ) . permute ( 1 , 0 ) . contiguous ( ) half_bias = reorder_weights ( self . bias ) / 2.0 kernel = torch . nn . Parameter ( kernel ) recurrent_kernel = torch . nn . Parameter ( recurrent_kernel ) bias1 = torch . nn . Parameter ( half_bias ) bias2 = torch . nn . Parameter ( half_bias . clone ( ) ) return kernel , recurrent_kernel , bias1 , bias2