1 rri_metrics.torchmetrics_multi

rri_metrics.torchmetrics_multi

Stateful evaluation for differentiable multi-step rollout returns.

1.1 Classes

Name Description
SelectedRolloutMetrics Accumulate selected-action rollout metrics from tensor batches.

1.1.1 SelectedRolloutMetrics

rri_metrics.torchmetrics_multi.SelectedRolloutMetrics(
    gamma=1.0,
    eps=DEFAULT_RRI_EPSILON,
)

Accumulate selected-action rollout metrics from tensor batches.

The metric reports trajectory-level means for finite-horizon return return_h, endpoint target gain, endpoint log-gain, valid selected steps, and endpoint validity. Trajectory-level aggregation avoids horizon-length bias and matches the proposal’s policy comparison table.

1.1.1.1 Attributes

Name Description
return_total Tensor["", float32] sum of finite trajectory returns.
return_count Tensor["", float32] number of finite trajectory returns.
endpoint_gain_total Tensor["", float32] sum of finite endpoint target gains.
endpoint_gain_count Tensor["", float32] number of finite endpoint target gains.
endpoint_log_gain_total Tensor["", float32] sum of finite endpoint log gains.
endpoint_log_gain_count Tensor["", float32] number of finite endpoint log gains.
valid_steps_total Tensor["", float32] sum of hard-valid selected rollout steps.
rollout_count Tensor["", float32] number of rollout trajectories presented.
valid_endpoint_count Tensor["", float32] number of trajectories with valid endpoints.

1.1.1.2 Methods

Name Description
update Accumulate one batch of selected target-rollout tensors.
compute Return aggregate rollout metrics with proposal-aligned keys.
1.1.1.2.1 update
rri_metrics.torchmetrics_multi.SelectedRolloutMetrics.update(
    rewards,
    initial_error,
    final_error,
    valid_mask=None,
)

Accumulate one batch of selected target-rollout tensors.

1.1.1.2.1.1 Parameters
Name Type Description Default
rewards Tensor Tensor["B H"] or Tensor["H"] selected rewards, normally root-normalized target gains. required
initial_error Tensor Initial target point-mesh errors d_0. required
final_error Tensor Endpoint target point-mesh errors d_H. required
valid_mask Tensor | None Optional hard supervision mask over selected rewards. None
1.1.1.2.2 compute
rri_metrics.torchmetrics_multi.SelectedRolloutMetrics.compute()

Return aggregate rollout metrics with proposal-aligned keys.

Back to top