Skip to content

Commit a2ea5a7

Browse files
committed
fix
1 parent 7b84efb commit a2ea5a7

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

deeplake/core/tensor.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,9 +1428,17 @@ def _extract_value(self, htype: str, fetch_chunks: bool = False):
14281428
raise Exception(f"Only supported for {htype} tensors.")
14291429

14301430
if self.ndim == 1:
1431-
return self.numpy(fetch_chunks=fetch_chunks)[0]
1431+
data = self.numpy(fetch_chunks=fetch_chunks)
1432+
if len(data) == 0:
1433+
return []
1434+
else:
1435+
return data[0]
14321436
else:
1433-
return [sample[0] for sample in self.numpy(aslist=True)]
1437+
data = self.numpy(aslist=True, fetch_chunks=fetch_chunks)
1438+
if len(data) == 0:
1439+
return []
1440+
else:
1441+
return [sample[0] for sample in data]
14341442

14351443
def text(self, fetch_chunks: bool = False):
14361444
"""Return text data. Only applicable for tensors with 'text' base htype."""

0 commit comments

Comments
 (0)