blazefl.core.reconstruct_from_shared_memory

blazefl.core.reconstruct_from_shared_memory#

blazefl.core.reconstruct_from_shared_memory(handle_obj: T, shm_obj: T) T[source]#

Recursively reconstructs an object from a handle-based object and a shared memory buffer object.

This function traverses both objects simultaneously. For each attribute, if the handle_obj contains an SHMHandle, it takes the corresponding tensor from the shm_obj. Otherwise, it takes the value from the handle_obj. This ensures that non-tensor data is also correctly restored.

Parameters:
  • handle_obj – The object containing SHMHandles as placeholders.

  • shm_obj – The object containing the actual tensors in shared memory.

Returns:

A new, fully reconstructed object with tensors populated from shared memory.