unilab.training.tensor_diagnostics.NanGuard

class unilab.training.tensor_diagnostics.NanGuard[source]

Bases: object

Detect bad tensor rows on-device and export dumps at an explicit host boundary.

Parameters:

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 None when every row is finite.

check_ctrl(ctrl[, step])

Return device-resident bad control-row indices, or None when 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:
capture(physics_state)[source]

Retain a detached device tensor snapshot for a later abnormal dump.

Parameters:

physics_state (Tensor | None)

Return type:

None

check(obs, reward, step=0)[source]

Return device-resident bad-row indices, or None when every row is finite.

Parameters:
Return type:

Tensor | None

check_ctrl(ctrl, step=0)[source]

Return device-resident bad control-row indices, or None when finite.

Parameters:
Return type:

Tensor | None

dump(nan_env_ids, model_file, step)[source]

Export one abnormal-state artifact at an explicit host boundary.

Parameters:
Return type:

str | None