draugr.torch_utilities.tensors.info.size_of_tensor

draugr.torch_utilities.tensors.info.size_of_tensor(obj: Tensor) int[source]

Get size in bytes of Tensor, torch.nn.Module or standard object.

Specific routines are defined for torch.tensor objects and torch.nn.Module objects. They will calculate how much memory in bytes those object consume.

If another object is passed, sys.getsizeof will be called on it.

This function works similarly to C++’s sizeof operator.

Parameters

obj – Object whose size will be measured.

Returns

Size in bytes of the object

Return type

int