torch-einops-utils 0.0.21__py3-none-any.whl → 0.0.23__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,6 +244,7 @@ def pad_sequence(
244
244
  value = 0.,
245
245
  left = False,
246
246
  dim_stack = 0,
247
+ return_stacked = True,
247
248
  return_lens = False,
248
249
  pad_lens = False # returns padding length instead of sequence lengths
249
250
  ):
@@ -258,15 +259,17 @@ def pad_sequence(
258
259
  pad_fn = pad_left_at_dim if left else pad_right_at_dim
259
260
  padded_tensors = [pad_fn(t, max_len - t_len, dim = dim, value = value) for t, t_len in zip(tensors, lens)]
260
261
 
261
- stacked = stack(padded_tensors, dim = dim_stack)
262
+ output = padded_tensors
263
+ if return_stacked:
264
+ output = stack(output, dim = dim_stack)
262
265
 
263
266
  if not return_lens:
264
- return stacked
267
+ return output
265
268
 
266
269
  if pad_lens:
267
270
  lens = max_len - lens
268
271
 
269
- return stacked, lens
272
+ return output, lens
270
273
 
271
274
  # tree flatten with inverse
272
275
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: torch-einops-utils
3
- Version: 0.0.21
3
+ Version: 0.0.23
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=raKFiWpRgGE7Vf7tTqkokU9525gr54lJMpQy_jnUTVI,6498
4
+ torch_einops_utils-0.0.23.dist-info/METADATA,sha256=vN8uy5uFGwLhsIqkEXwf8uvzvmpVH9Vm2gprQjrzKqw,2139
5
+ torch_einops_utils-0.0.23.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
6
+ torch_einops_utils-0.0.23.dist-info/licenses/LICENSE,sha256=e6AOF7Z8EFdK3IdcL0x0fLw4cY7Q0d0kNR0o0TmBewM,1066
7
+ torch_einops_utils-0.0.23.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=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,,