Skip to content

Commit

Permalink
Updated to avoid in-place modification errors
Browse files Browse the repository at this point in the history
  • Loading branch information
michellemli authored Dec 22, 2024
1 parent dc16b51 commit 1b1fd77
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion xlstm/blocks/xlstm_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ def __init__(self, config: xLSTMBlockConfig) -> None:
self.reset_parameters()

def forward(self, x: torch.Tensor, **kwargs) -> torch.Tensor:
x = x + self.xlstm(self.xlstm_norm(x), **kwargs)
#x = x + self.xlstm(self.xlstm_norm(x), **kwargs) # Original
x = x + self.xlstm(self.xlstm_norm(x.clone()), **kwargs) # Updated to avoid in-place modification errors
if self.ffn is not None:
x = x + self.ffn(self.ffn_norm(x), **kwargs)
return x
Expand Down

0 comments on commit 1b1fd77

Please sign in to comment.