blazefl.utils.serialize_model#
- blazefl.utils.serialize_model(model: Module, cpu: bool = True) Tensor [source]#
Serialize a PyTorch model’s parameters into a flat tensor.
- Parameters:
model (torch.nn.Module) – The PyTorch model to serialize.
cpu (bool) – Whether to move the serialized parameters to the CPU.
- Returns:
A flat tensor containing the serialized parameters.
- Return type:
torch.Tensor