cutcutcodec.core.compilation.sympy_to_torch.memory_check.overlap
- cutcutcodec.core.compilation.sympy_to_torch.memory_check.overlap(strides: tuple[int], shapes: tuple[int]) bool[source]
Return True if all items are not memory independant.
Parameters
- stridestuple[int]
The step on each dimension.
- shapestuple[int]
Each dimension lenght.
Returns
- overlapbool
True if some data are overlapping, it may return True in some situation of non overlaping. When False, it is 100% shure it is memory safe!
Examples
>>> from cutcutcodec.core.compilation.sympy_to_torch.memory_check import overlap >>> overlap((0,), (10,)) True >>> overlap((1,), (10,)) # c contiguous False >>> overlap((2,), (10,)) False >>> overlap((10, 0), (100, 10)) True >>> overlap((9, 1), (100, 10)) True >>> overlap((10, 1), (100, 10)) # c contiguous False >>> overlap((10, 2), (100, 10)) True >>> overlap((20, 2), (100, 10)) False >>>