Skip to content

Commit

Permalink
Merge pull request #2345 from activeloopai/fy_fix_iter
Browse files Browse the repository at this point in the history
[AL-2280] Fix numpy slowdown with iteration and groups
  • Loading branch information
FayazRahman committed May 12, 2023
2 parents 266e1e8 + ab55a29 commit 3dd678b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions deeplake/api/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2457,3 +2457,16 @@ def test_sequence_numpy_bug(memory_ds):
ds.abc.numpy()

assert ds.abc.numpy(aslist=True) == [[1, 2], [1, 2, 3], [1, 2, 3, 4]]


def test_iterate_with_groups(memory_ds):
with memory_ds as ds:
ds.create_tensor("x/y/z")

ds["x/y/z"].extend(list(range(100)))

for i, sample in enumerate(ds):
assert sample["x/y"].z.is_iteration == True

for i, sample in enumerate(ds):
assert sample["x/y/z"].is_iteration == True
1 change: 1 addition & 0 deletions deeplake/core/dataset/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ def __getitem__(
verbose=False,
version_state=self.version_state,
path=self.path,
is_iteration=is_iteration,
link_creds=self.link_creds,
pad_tensors=self._pad_tensors,
enabled_tensors=self.enabled_tensors,
Expand Down

0 comments on commit 3dd678b

Please sign in to comment.