unilab.training.tensor_diagnostics.NanGuard¶
- class unilab.training.tensor_diagnostics.NanGuard[source]¶
Bases:
objectDetect bad tensor rows on-device and export dumps at an explicit host boundary.
- Parameters:
cfg (
NanGuardCfg)num_envs (
int)supports_state_playback (
bool)
Methods
__init__(cfg, num_envs, supports_state_playback)capture(physics_state)Retain a detached device tensor snapshot for a later abnormal dump.
check(obs, reward[, step])Return device-resident bad-row indices, or
Nonewhen every row is finite.check_ctrl(ctrl[, step])Return device-resident bad control-row indices, or
Nonewhen finite.dump(nan_env_ids, model_file, step)Export one abnormal-state artifact at an explicit host boundary.
- __init__(cfg, num_envs, supports_state_playback)[source]¶
- Parameters:
cfg (
NanGuardCfg)num_envs (
int)supports_state_playback (
bool)
- check(obs, reward, step=0)[source]¶
Return device-resident bad-row indices, or
Nonewhen every row is finite.