titans-pytorch 0.4.11__tar.gz → 0.4.12__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {titans_pytorch-0.4.11 → titans_pytorch-0.4.12}/PKG-INFO +1 -1
- {titans_pytorch-0.4.11 → titans_pytorch-0.4.12}/pyproject.toml +1 -1
- {titans_pytorch-0.4.11 → titans_pytorch-0.4.12}/titans_pytorch/neural_memory.py +3 -1
- {titans_pytorch-0.4.11 → titans_pytorch-0.4.12}/.github/workflows/python-publish.yml +0 -0
- {titans_pytorch-0.4.11 → titans_pytorch-0.4.12}/.github/workflows/test.yaml +0 -0
- {titans_pytorch-0.4.11 → titans_pytorch-0.4.12}/.gitignore +0 -0
- {titans_pytorch-0.4.11 → titans_pytorch-0.4.12}/LICENSE +0 -0
- {titans_pytorch-0.4.11 → titans_pytorch-0.4.12}/README.md +0 -0
- {titans_pytorch-0.4.11 → titans_pytorch-0.4.12}/data/README.md +0 -0
- {titans_pytorch-0.4.11 → titans_pytorch-0.4.12}/data/enwik8.gz +0 -0
- {titans_pytorch-0.4.11 → titans_pytorch-0.4.12}/fig1.png +0 -0
- {titans_pytorch-0.4.11 → titans_pytorch-0.4.12}/fig2.png +0 -0
- {titans_pytorch-0.4.11 → titans_pytorch-0.4.12}/tests/test_titans.py +0 -0
- {titans_pytorch-0.4.11 → titans_pytorch-0.4.12}/titans_pytorch/__init__.py +0 -0
- {titans_pytorch-0.4.11 → titans_pytorch-0.4.12}/titans_pytorch/mac_transformer.py +0 -0
- {titans_pytorch-0.4.11 → titans_pytorch-0.4.12}/titans_pytorch/memory_models.py +0 -0
- {titans_pytorch-0.4.11 → titans_pytorch-0.4.12}/train_mac.py +0 -0
@@ -161,7 +161,8 @@ def newtonschulz5(
|
|
161
161
|
eps = 1e-7,
|
162
162
|
coefs = (3.4445, -4.7750, 2.0315)
|
163
163
|
):
|
164
|
-
|
164
|
+
if t.ndim <= 3:
|
165
|
+
return t
|
165
166
|
|
166
167
|
shape = t.shape
|
167
168
|
should_transpose = shape[-2] > shape[-1]
|
@@ -169,6 +170,7 @@ def newtonschulz5(
|
|
169
170
|
if should_transpose:
|
170
171
|
t = t.transpose(-1, -2)
|
171
172
|
|
173
|
+
t, inv_pack = pack_one_with_inverse(t, '* i j')
|
172
174
|
t = t / t.norm(dim = (-1, -2), keepdim = True).clamp(min = eps)
|
173
175
|
|
174
176
|
a, b, c = coefs
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|