state_condition_pool
state_condition_pool
¶
Create observation-only state vectors for conditional latent losses.
StateConditionPool
¶
Bases: Module
Build the state vector used by conditional latent regularizers.
The learned prior sees only observations, so its input tokens are the
right place to define s for losses that compare q(z|s) with
p(z|s). This module averages those observation tokens into one vector
per batch element while respecting padding masks.
Callers should pass only observation tokens. In the current priors, the CLS token is appended after the observation tokens and is intentionally removed before this module is called. Posterior/action tokens should never be included here, otherwise the "state" coordinate would leak action information into the conditional matching loss.
Source code in src/versatil/models/decoding/latent/prior/state_condition_pool.py
forward
¶
Return one normalized observation vector per batch element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tokens
|
Tensor
|
Observation token sequence with shape
|
required |
padding_mask
|
Tensor | None
|
Optional boolean mask with shape |
None
|
Returns:
| Type | Description |
|---|---|
Tensor
|
A tensor with shape |
Tensor
|
can be concatenated with prior and posterior latent samples so |
Tensor
|
MMD/OT compare |