unilab.tasks.motion_tracking.common.tensor_sampler

Device-resident motion sampling for tensor Manager owners.

This owner owns the cold metadata derivation and hot tensor lifecycle: adaptive failure statistics, frame advance, reset sampling, and sampling diagnostics stay on one Torch device and consume the Manager-owned Torch generator.

Classes

MotionSampler

Torch-native adaptive/mixed motion sampler for MotionCommand.

MotionSamplerDiagnostics

Count observed compatibility paths that would defeat tensor-only resets.

class unilab.tasks.motion_tracking.common.tensor_sampler.MotionSampler[source]

Bases: object

Torch-native adaptive/mixed motion sampler for MotionCommand.

Parameters:
__init__(*, mode, num_envs, num_frames, clip_offsets, clip_end_frames, bin_count, adaptive_lambda, adaptive_kernel_size, adaptive_uniform_ratio, adaptive_alpha, start_ratio, initial_frames, initial_clip_end_frames, device)[source]
Parameters:
property bin_failed_count: Tensor
sample_frames(reset_mask, torch_rng)[source]

Sample full-width frames and publish only selected rows.

Parameters:
Return type:

Tensor

update_failure_stats(terminated)[source]
Parameters:

terminated (Tensor)

Return type:

None

step_full(active, time_steps)[source]

Advance and publish full-width frame mirrors without row gathers.

Parameters:
Return type:

Tensor

class unilab.tasks.motion_tracking.common.tensor_sampler.MotionSamplerDiagnostics[source]

Bases: object

Count observed compatibility paths that would defeat tensor-only resets.

The sampler itself no longer transfers rows to the host. We retain a real (not synthesized) counter for reset sampling calls so diagnostics can assert that reset dispatch happened while host-transfer counts remain structurally zero.

Parameters:
  • reset_dispatches (int)

  • reset_host_row_transfers (int)

  • step_host_mirror_transfers (int)

reset_dispatches: int = 0
reset_host_row_transfers: int = 0
step_host_mirror_transfers: int = 0
record_reset_dispatch()[source]
Return type:

None

property total: int
__init__(reset_dispatches=0, reset_host_row_transfers=0, step_host_mirror_transfers=0)
Parameters:
  • reset_dispatches (int)

  • reset_host_row_transfers (int)

  • step_host_mirror_transfers (int)