Skip to content
Snippets Groups Projects
Commit 9086dfc7 authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

[data.datamodule] Adjust sample storage size calculation

parent 1ab24d4b
Branches
Tags
1 merge request!6Making use of LightningDataModule and simplification of data loading
...@@ -49,7 +49,8 @@ def _sample_size_bytes(s: Sample) -> int: ...@@ -49,7 +49,8 @@ def _sample_size_bytes(s: Sample) -> int:
"""Returns a tensor size in bytes.""" """Returns a tensor size in bytes."""
return int(t.element_size() * torch.prod(torch.tensor(t.shape))) return int(t.element_size() * torch.prod(torch.tensor(t.shape)))
size = int(s[0].element_size() * torch.prod(torch.tensor(s[0].shape))) size = sys.getsizeof(s[0]) # tensor metadata
size += int(s[0].element_size() * torch.prod(torch.tensor(s[0].shape)))
size += sys.getsizeof(s[1]) size += sys.getsizeof(s[1])
# check each element - if it is a tensor, then adds its total space in # check each element - if it is a tensor, then adds its total space in
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment