Skip to content

Commit

Permalink
add logic to allow negative length slicing
Browse files Browse the repository at this point in the history
  • Loading branch information
limiteinductive committed Dec 12, 2023
1 parent 7992258 commit 06822af
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/refiners/fluxion/layers/basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ def __init__(self, dim: int, start: int, length: int) -> None:
self.length = length

def forward(self, x: Tensor) -> Tensor:
if self.length < 0:
return x.narrow(self.dim, self.start, x.shape[self.dim] - self.start + self.length + 1)
return x.narrow(self.dim, self.start, self.length)


Expand Down

0 comments on commit 06822af

Please sign in to comment.