r""" Assign concrete location in the buffer for each SharedObject.offset. Assuming all the passed in shared objects belong to the same memory buffer.
(
shared_objects: List[SharedObject], input_total_size: int = 0
)
| 752 | |
| 753 | |
| 754 | def materialize_buffer( |
| 755 | shared_objects: List[SharedObject], input_total_size: int = 0 |
| 756 | ) -> int: |
| 757 | r""" |
| 758 | Assign concrete location in the buffer for each SharedObject.offset. |
| 759 | |
| 760 | Assuming all the passed in shared objects belong to the same memory buffer. |
| 761 | """ |
| 762 | total_size = input_total_size |
| 763 | for sobj in shared_objects: |
| 764 | sobj.offset = total_size |
| 765 | total_size += sobj.size |
| 766 | return total_size |
| 767 | |
| 768 | |
| 769 | def _does_not_overlap(sobj: SharedObject, spec: TensorSpec) -> bool: |