r""" Check if a shared object and a tensor do not overlap.
(sobj: SharedObject, spec: TensorSpec)
| 767 | |
| 768 | |
| 769 | def _does_not_overlap(sobj: SharedObject, spec: TensorSpec) -> bool: |
| 770 | r""" |
| 771 | Check if a shared object and a tensor do not overlap. |
| 772 | """ |
| 773 | for alloc in sobj.allocations: |
| 774 | if not ( |
| 775 | spec.lifetime[1] < alloc.spec.lifetime[0] |
| 776 | or spec.lifetime[0] > alloc.spec.lifetime[1] |
| 777 | ): |
| 778 | return False |
| 779 | return True |
| 780 | |
| 781 | |
| 782 | def _find_max_overlapping_allocations_offset( |