Auto-sync: 2026-06-27 10:26:03 (part 3)
Browse files
tests/test_maniskill_policy_rollout.py
CHANGED
|
@@ -265,3 +265,26 @@ def test_lattice_mode_respects_candidate_mask() -> None:
|
|
| 265 |
|
| 266 |
assert torch.allclose(actions, mean)
|
| 267 |
assert index.tolist() == [1]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 265 |
|
| 266 |
assert torch.allclose(actions, mean)
|
| 267 |
assert index.tolist() == [1]
|
| 268 |
+
|
| 269 |
+
|
| 270 |
+
def test_retrieval_lattice_mode_uses_candidate_tensor() -> None:
|
| 271 |
+
import torch
|
| 272 |
+
|
| 273 |
+
mean = torch.zeros(1, 1, 3)
|
| 274 |
+
offset = torch.full_like(mean, 0.4)
|
| 275 |
+
model = _StubModel(torch, mean, best_offset=offset)
|
| 276 |
+
candidates = torch.stack([mean, mean + offset], dim=1)
|
| 277 |
+
actions, index = _select_action_chunk(
|
| 278 |
+
model,
|
| 279 |
+
observations=torch.zeros(1, 3),
|
| 280 |
+
instructions=["a"],
|
| 281 |
+
torch=torch,
|
| 282 |
+
selection_mode="retrieval_lattice",
|
| 283 |
+
num_candidates=1,
|
| 284 |
+
candidate_sigma=0.0,
|
| 285 |
+
selection_seed=0,
|
| 286 |
+
action_candidates=candidates,
|
| 287 |
+
)
|
| 288 |
+
|
| 289 |
+
assert torch.allclose(actions, mean + offset)
|
| 290 |
+
assert index.tolist() == [1]
|