anhtld commited on
Commit
313eafb
·
verified ·
1 Parent(s): d8ce858

Auto-sync: 2026-06-28 07:13:10 (part 3)

Browse files
Files changed (1) hide show
  1. tests/test_trainer.py +25 -0
tests/test_trainer.py CHANGED
@@ -10,7 +10,9 @@ from dovla_cil.training.trainer import (
10
  DoVLATrainer,
11
  TrainerConfig,
12
  _best_records_by_group,
 
13
  _cross_state_pair_indices,
 
14
  _reward_utility_values,
15
  )
16
  from dovla_cil.utils.io import read_json
@@ -178,3 +180,26 @@ def test_policy_target_map_overrides_group_target_with_fallback() -> None:
178
  "g0": "field_choice",
179
  "g1": "fallback",
180
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  DoVLATrainer,
11
  TrainerConfig,
12
  _best_records_by_group,
13
+ _coerce_policy_target_action,
14
  _cross_state_pair_indices,
15
+ _load_policy_target_action_map,
16
  _reward_utility_values,
17
  )
18
  from dovla_cil.utils.io import read_json
 
180
  "g0": "field_choice",
181
  "g1": "fallback",
182
  }
183
+
184
+
185
+ def test_policy_target_action_map_loads_continuous_targets(tmp_path: Path) -> None:
186
+ path = tmp_path / "targets.json"
187
+ path.write_text(
188
+ """
189
+ {
190
+ "targets": {
191
+ "g0": {"record_id": "r0", "action_values": [[0.1, 0.2], [0.3, 0.4]]},
192
+ "g1": "legacy_record_id"
193
+ }
194
+ }
195
+ """
196
+ )
197
+
198
+ loaded = _load_policy_target_action_map(path)
199
+
200
+ assert loaded == {"g0": [[0.1, 0.2], [0.3, 0.4]]}
201
+ assert _coerce_policy_target_action(
202
+ loaded["g0"],
203
+ action_dim=3,
204
+ action_horizon=3,
205
+ ) == [[0.1, 0.2, 0.0], [0.3, 0.4, 0.0], [0.0, 0.0, 0.0]]