caldera.utils.same_storage

caldera.utils.same_storage(x, y, empty_does_not_share_storage=True)[source]

Checks if two tensors share storage.

Parameters
  • x (Tensor) – first tensor

  • y (Tensor) – second tensor

  • empty_does_not_share_storage (bool) – if True (default), will return False if either tensor is empty (despite that they technically data_ptr are the same).

Return type

bool

Returns

if the tensor shares the same storage