send_tensordict#
- async tensordict._ucxx.send_tensordict(endpoint, td: TensorDictBase, *, consolidated: bool = True) None#
Sends a tensordict over a UCXX endpoint, with its metadata, in one call.
Warning
send_tensordictis experimental: its API can change in a minor release without a deprecation cycle.Unlike a
TensorDictPipe, it keeps no state: each call sends the metadata (as JSON) and then the consolidated storage. The receiver callsrecv_tensordict(). It needs the optionalucxxpackage. The protocol does not authenticate the peer: use it only on a trusted network.- Parameters:
endpoint (ucxx.Endpoint) – the endpoint to send through, for example from
ucxx.create_endpoint.td (TensorDictBase) – the tensordict to send.
- Keyword Arguments:
consolidated (bool, optional) – if
True, consolidates the tensordict (seeconsolidate()) unless it is already, and sends its storage as one buffer. IfFalse, sends the tensor leaves of the tensordict, nested ones included, one by one, in the format of a pipe withconsolidated=False: the receiver callsrecv_tensordict()withconsolidated=False. Defaults toTrue.- Raises:
ImportError – if
ucxxis not installed.ValueError – with
consolidated=False, if the tensordict holds a non-tensor entry other than aNonTensorDataorNonTensorStackwhose values arestr,int,float,bool,None, or lists or dicts (withstrkeys) of them. Send it withconsolidated=True.