unisim.backend.motrix.tensor

Persistent packed tensor transfers for the MotrixSim CPU host bridge.

Functions

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

Validate the intentionally narrow MotrixSim tensor profile.

sensor_view(backend, name, device)

Copy one authoritative CPU sensor block to a Torch device.

set_state_tensor(backend, env_indices, qpos, ...)

Bridge selected reset through one persistent packed direct-API plan.

set_state_tensor_mask(backend, reset_mask, ...)

Commit full-width reset tensors selected by a backend-owned bool mask.

state_views(backend, fields, device)

Copy requested state blocks to one Torch device in one packed H2D.

step_tensor(backend, ctrl[, nsteps])

Bridge control through one persistent packed direct-API plan.

tensor_capabilities(backend)

Return the deliberately narrow MotrixSim tensor capability matrix.

Classes

MotrixHostBridgeTransferPlan

One stable MotrixSim layout for explicit accelerator/CPU boundaries.

class unisim.backend.motrix.tensor.MotrixHostBridgeTransferPlan[source]

Bases: HostBridgeTransferPlan

One stable MotrixSim layout for explicit accelerator/CPU boundaries.

MotrixSim remains CPU-authoritative. Control, reset, and packed reads each cross the device boundary at most once. CUDA transfers follow and synchronize the caller’s current Torch stream.

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.motrix.tensor.require_motrix_tensor_runtime(backend, *, require_callback_free=False)[source]

Validate the intentionally narrow MotrixSim tensor profile.

Parameters:
Return type:

None

unisim.backend.motrix.tensor.sensor_view(backend, name, device)[source]

Copy one authoritative CPU sensor block to a Torch device.

Parameters:
Return type:

Any

unisim.backend.motrix.tensor.set_state_tensor(backend, env_indices, qpos, qvel, randomization=None)[source]

Bridge selected reset through one persistent packed direct-API plan.

Parameters:
Return type:

dict | None

unisim.backend.motrix.tensor.set_state_tensor_mask(backend, reset_mask, qpos, qvel, randomization=None, *, full_refresh=False)[source]

Commit full-width reset tensors selected by a backend-owned bool mask.

Parameters:
Return type:

dict | None

unisim.backend.motrix.tensor.state_views(backend, fields, device)[source]

Copy requested state blocks to one Torch device in one packed H2D.

Parameters:
Return type:

dict[str, Any]

unisim.backend.motrix.tensor.step_tensor(backend, ctrl, nsteps=1)[source]

Bridge control through one persistent packed direct-API plan.

Parameters:
Return type:

dict | None

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

Return the deliberately narrow MotrixSim tensor capability matrix.

Parameters:

backend (MotrixBackend)

Return type:

TensorLifecycleCapabilities