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

[data.datamodule] Adjust sample storage size calculation

parent d0b7d8b8
No related branches found
No related tags found
No related merge requests found
Pipeline #76266 failed
...@@ -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.
Finish editing this message first!
Please register or to comment