import torch
from dataclasses import dataclass
from typing import Literal, TypeVar

@dataclass(frozen=True)
class SHMHandle: ...
T = TypeVar('T')

def process_tensors_in_object(obj: T, mode: Literal['move', 'replace'], max_depth: int = 10) -> T: ...
def reconstruct_from_shared_memory(handle_obj: T, shm_obj: T) -> T: ...
def serialize_model(model: torch.nn.Module, cpu: bool = True) -> torch.Tensor: ...
def deserialize_model(model: torch.nn.Module, serialized_parameters: torch.Tensor) -> None: ...
