unisim.backend.drake.tensor

Persistent packed tensor transfers for the Drake CPU host bridge.

Functions

require_drake_tensor_runtime(backend, *[, ...])

Validate the intentionally narrow initial Drake tensor profile.

resolve_drake_tensor_device(device)

Resolve and validate a Drake tensor target without importing Torch eagerly.

tensor_capabilities(backend)

Return the initial, fail-closed Drake tensor capability matrix.

Classes

DrakeHostBridgeTransferPlan

One stable Drake layout for explicit accelerator/CPU boundaries.

class unisim.backend.drake.tensor.DrakeHostBridgeTransferPlan[source]

Bases: HostBridgeTransferPlan

One stable Drake layout for explicit accelerator/CPU boundaries.

DrakeUni physics remains authoritative on CPU. Each semantic operation moves at most one contiguous packet, and CUDA transfers are synchronized on the caller’s current Torch stream. The initial profile excludes fixed variants, interval forces, reset randomization, and host pre-step callbacks.

Parameters:
__init__(backend, spec)[source]
Parameters:
property spec: TensorIOSpec

Return the immutable layout request used to compile this plan.

property transfer_stats: dict[str, int]

Return cumulative semantic transfer and synchronization counters.

write_control(ctrl)[source]

Stage one complete control tensor on the host.

Parameters:

ctrl (Any)

Return type:

None

step(nsteps=1)[source]

Run CPU physics with the tensor control staged by write_control.

Parameters:

nsteps (int)

Return type:

dict | None

read_state_sensors()[source]

Return persistent tensor views after one packed H2D read.

Return type:

Mapping[str, Any]

apply_reset(env_indices, qpos, qvel, randomization=None)[source]

Pack selected reset rows once, D2H them, and commit CPU physics.

Parameters:
Return type:

dict | None

read_selected_state_sensors()[source]

Return full views after one packed selected-row post-reset H2D.

Return type:

Mapping[str, Any]

close()[source]

Release transfer staging ownership without closing CPU physics.

Return type:

None

unisim.backend.drake.tensor.tensor_capabilities(backend)[source]

Return the initial, fail-closed Drake tensor capability matrix.

Parameters:

backend (DrakeBackend)

Return type:

TensorLifecycleCapabilities

unisim.backend.drake.tensor.require_drake_tensor_runtime(backend, *, require_callback_free=False)[source]

Validate the intentionally narrow initial Drake tensor profile.

Parameters:
Return type:

None

unisim.backend.drake.tensor.resolve_drake_tensor_device(device)[source]

Resolve and validate a Drake tensor target without importing Torch eagerly.

Parameters:

device (Any | None)

Return type:

Any