nvflare.app_opt.tensor_stream.sender module

class TensorSender(engine: StreamableEngine, ctx_prop_key: str, format: str, tasks: list[str], channel: str = 'tensor_stream')[source]

Bases: object

Handles sending tensors between server and clients.

Initialize the TensorSender.

Parameters:
  • engine (StreamableEngine) – The streamable engine to use for streaming.

  • format (str) – The format of the tensors to send.

  • tasks (list[str]) – The list of tasks to send tensors for.

  • ctx_prop_key (str) – The context property key to send tensors for.

  • channel (str) – The channel to use for streaming. Default is TENSORS_CHANNEL.

send(fl_ctx: FLContext, tensor_send_timeout: float) None[source]

Send tensors to the peer.

Parameters:
  • fl_ctx (FLContext) – The FLContext for the current operation.

  • tensor_send_timeout (float) – Timeout for each tensor entry transfer.

store_tensors(fl_ctx: FLContext)[source]

Parse tensors from the FLContext and store them for sending.

Parameters:

fl_ctx (FLContext) – The FLContext for the current operation.