Auto-sync: 2026-06-28 07:49:25 (part 3)
Browse files
tests/test_maniskill_policy_rollout.py
CHANGED
|
@@ -201,6 +201,31 @@ def test_field_mode_can_prefer_perturbed_candidate() -> None:
|
|
| 201 |
assert index.tolist()[0] != 0
|
| 202 |
|
| 203 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 204 |
def test_field_mode_scores_clamped_candidates() -> None:
|
| 205 |
import torch
|
| 206 |
|
|
|
|
| 201 |
assert index.tolist()[0] != 0
|
| 202 |
|
| 203 |
|
| 204 |
+
def test_retrieval_residual_margin_can_abstain_to_policy() -> None:
|
| 205 |
+
import torch
|
| 206 |
+
|
| 207 |
+
mean = torch.zeros(1, 1, 1)
|
| 208 |
+
offset = torch.full_like(mean, 0.4)
|
| 209 |
+
model = _StubModel(torch, mean, best_offset=offset)
|
| 210 |
+
residuals = torch.tensor([[[[0.0]], [[0.4]]]], dtype=torch.float32)
|
| 211 |
+
|
| 212 |
+
actions, index = _select_action_chunk(
|
| 213 |
+
model,
|
| 214 |
+
observations=torch.zeros(1, 3),
|
| 215 |
+
instructions=["a"],
|
| 216 |
+
torch=torch,
|
| 217 |
+
selection_mode="retrieval_residual",
|
| 218 |
+
num_candidates=1,
|
| 219 |
+
candidate_sigma=0.0,
|
| 220 |
+
selection_seed=0,
|
| 221 |
+
selection_margin=0.2,
|
| 222 |
+
action_candidates=residuals,
|
| 223 |
+
)
|
| 224 |
+
|
| 225 |
+
assert torch.allclose(actions, mean)
|
| 226 |
+
assert index.tolist() == [0]
|
| 227 |
+
|
| 228 |
+
|
| 229 |
def test_field_mode_scores_clamped_candidates() -> None:
|
| 230 |
import torch
|
| 231 |
|