torch-einops-utils 0.0.20__py3-none-any.whl → 0.0.21__py3-none-any.whl

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.
@@ -244,7 +244,8 @@ def pad_sequence(
244
244
  value = 0.,
245
245
  left = False,
246
246
  dim_stack = 0,
247
- return_lens = False
247
+ return_lens = False,
248
+ pad_lens = False # returns padding length instead of sequence lengths
248
249
  ):
249
250
  if len(tensors) == 0:
250
251
  return None
@@ -262,6 +263,9 @@ def pad_sequence(
262
263
  if not return_lens:
263
264
  return stacked
264
265
 
266
+ if pad_lens:
267
+ lens = max_len - lens
268
+
265
269
  return stacked, lens
266
270
 
267
271
  # tree flatten with inverse
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: torch-einops-utils
3
- Version: 0.0.20
3
+ Version: 0.0.21
4
4
  Summary: Personal utility functions
5
5
  Project-URL: Homepage, https://pypi.org/project/torch-einops-utils/
6
6
  Project-URL: Repository, https://github.com/lucidrains/torch-einops-utils
@@ -0,0 +1,7 @@
1
+ torch_einops_utils/__init__.py,sha256=l7S9xJOlbMfwofQD3RI2Z4QxT3H713XSPc1zN_kF4Ww,982
2
+ torch_einops_utils/save_load.py,sha256=K-i7nmLyXBHdAfBLN3rGQzI3NVf6RRwF_GcrKQnfQsc,2669
3
+ torch_einops_utils/torch_einops_utils.py,sha256=exfuRHRBP1YK_3BIpjquFm3fJIX1d9-rNYP1wt9lzoE,6427
4
+ torch_einops_utils-0.0.21.dist-info/METADATA,sha256=1NMFNMuPjmI5xIw4d1r46XtEcotl-OjRsjk8p6lh68k,2139
5
+ torch_einops_utils-0.0.21.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
6
+ torch_einops_utils-0.0.21.dist-info/licenses/LICENSE,sha256=e6AOF7Z8EFdK3IdcL0x0fLw4cY7Q0d0kNR0o0TmBewM,1066
7
+ torch_einops_utils-0.0.21.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- torch_einops_utils/__init__.py,sha256=l7S9xJOlbMfwofQD3RI2Z4QxT3H713XSPc1zN_kF4Ww,982
2
- torch_einops_utils/save_load.py,sha256=K-i7nmLyXBHdAfBLN3rGQzI3NVf6RRwF_GcrKQnfQsc,2669
3
- torch_einops_utils/torch_einops_utils.py,sha256=73w4l6McRFEQCcwPSJf0XcIKDA0U8KLsh2rpzHTOqko,6304
4
- torch_einops_utils-0.0.20.dist-info/METADATA,sha256=DseXwtZ-HClVQ93WZ89ImwSTGCFjzAu3jIQPZFzcQZw,2139
5
- torch_einops_utils-0.0.20.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
6
- torch_einops_utils-0.0.20.dist-info/licenses/LICENSE,sha256=e6AOF7Z8EFdK3IdcL0x0fLw4cY7Q0d0kNR0o0TmBewM,1066
7
- torch_einops_utils-0.0.20.dist-info/RECORD,,