:mod:`heat.memory` ======================= .. py:module:: heat.core.memory .. autoapi-nested-parse:: Utilities to manage the internal memory of an array. Module Contents --------------- .. function:: copy(x: heat.core.dndarray.DNDarray) -> heat.core.dndarray.DNDarray Return a deep copy of the given object. :param x: Input array to be copied. :type x: DNDarray .. rubric:: Examples >>> a = ht.array([1, 2, 3]) >>> b = ht.copy(a) >>> b DNDarray([1, 2, 3], dtype=ht.int64, device=cpu:0, split=None) >>> a[0] = 4 >>> a DNDarray([4, 2, 3], dtype=ht.int64, device=cpu:0, split=None) >>> b DNDarray([1, 2, 3], dtype=ht.int64, device=cpu:0, split=None) .. function:: sanitize_memory_layout(x: torch.Tensor, order: str = 'C') -> torch.Tensor Return the given object with memory layout as defined below. The default memory distribution is assumed. :param x: Input data :type x: torch.Tensor :param order: Default is ``'C'`` as in C-like (row-major) memory layout. The array is stored first dimension first (rows first if ``ndim=2``). Alternative is ``'F'``, as in Fortran-like (column-major) memory layout. The array is stored last dimension first (columns first if ``ndim=2``). :type order: str, optional.