Skip to content

Commit

Permalink
perf: clear buffers
Browse files Browse the repository at this point in the history
  • Loading branch information
junhsss committed Feb 23, 2023
1 parent c83c07e commit 2feb1ad
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion einorm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

__all__ = ["Einorm"]

__version__ = "0.1.0"
__version__ = "0.1.1"
8 changes: 4 additions & 4 deletions einorm/einorm.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,18 @@ def __init__(
_perm = torch.tensor(
_perm_dims,
dtype=torch.long,
device=device,
)

self.perm = _perm

_inv = torch.empty_like(_perm)
_inv[_perm] = torch.arange(_perm.size(0))

self.inv = _inv

# skip permute whenever possible
self.skip_perm = _perm_dims == list(range(len(_pattern)))

self.register_buffer("perm", _perm)
self.register_buffer("inv", _inv)

group_shape: Tuple[int, ...] = ()
if group:
for axis in _group:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "einorm"
version = "0.1.0"
version = "0.1.1"
description = "An einops-style generalized normalization layer."
authors = ["junhsss <junhsssr@gmail.com>"]
readme = "README.md"
Expand Down

0 comments on commit 2feb1ad

Please sign in to comment.