unilab.base.reset_selectors.ResetMaskBuffer

class unilab.base.reset_selectors.ResetMaskBuffer[source]

Bases: object

Reusable fixed-width bool reset mask owned by one conversion site.

scatter/resolve rewrite the internal storage in place and return it; the returned tensor aliases that storage and stays valid only until the next call on the same buffer. Every site whose masks may be live at the same time owns a separate instance: the env reset-transaction entry, the env-owned event-term scratch, each manager, and each class-based term. Buffer lifetime follows its owner (the env or manager instance), so separate env instances never share storage.

Parameters:

Methods

__init__(num_envs, device)

resolve(selector, *, owner)

Resolve a public reset selector like resolve_reset_mask.

scatter(env_ids)

Rewrite the buffer from row indices and return the aliased mask.

Attributes

__init__(num_envs, device)[source]
Parameters:
property num_envs: int
property device: device
scatter(env_ids)[source]

Rewrite the buffer from row indices and return the aliased mask.

Parameters:

env_ids (Tensor)

Return type:

Tensor

resolve(selector, *, owner)[source]

Resolve a public reset selector like resolve_reset_mask.

Every selector is normalized to env_ids and scattered into this buffer.

Parameters:
Return type:

Tensor