fix(ensemble): DQN adapter tests use correct STATE_DIM input size
The DQN inference adapter tests hardcoded `vec![0.1; 56]` as the feature vector, but the DQN model's first shared layer expects STATE_DIM=96 inputs. cuBLAS gemm_ex was reading 40 elements past the end of the 56-allocated CudaSlice — uninitialized memory that happened to give consistent-enough values for the deterministic test to pass on the pre-change heap layout, and for other tests not to notice the out-of-bounds read. Surfaced by the Part 1 checkpoint-load work: adding the CUDA_LOCK mutex and a new weight_mu_mut method to NoisyLinear shifted allocation patterns enough that the uninitialized tail now reads different values between the two predict() calls in test_dqn_adapter_deterministic, flipping the argmax. Replace all three `vec![0.1|0.3; 56]` occurrences with `vec![...; ml_core::state_layout::STATE_DIM]` so the tests actually exercise the model with in-bounds memory. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -303,7 +303,7 @@ mod tests {
|
||||
let _guard = CUDA_LOCK.lock().unwrap_or_else(|p| p.into_inner());
|
||||
let adapter = DqnInferenceAdapter::new_on_device(test_config(), shared_device()).unwrap();
|
||||
let fv = FeatureVector {
|
||||
values: vec![0.1; 56],
|
||||
values: vec![0.1; ml_core::state_layout::STATE_DIM],
|
||||
timestamp: 1700000000_000_000,
|
||||
};
|
||||
let pred = adapter.predict(&fv).unwrap();
|
||||
@@ -328,7 +328,7 @@ mod tests {
|
||||
let _guard = CUDA_LOCK.lock().unwrap_or_else(|p| p.into_inner());
|
||||
let adapter = DqnInferenceAdapter::new_on_device(test_config(), shared_device()).unwrap();
|
||||
let fv = FeatureVector {
|
||||
values: vec![0.1; 56],
|
||||
values: vec![0.1; ml_core::state_layout::STATE_DIM],
|
||||
timestamp: 1700000000_000_000,
|
||||
};
|
||||
let pred1 = adapter.predict(&fv).unwrap();
|
||||
@@ -361,7 +361,7 @@ mod tests {
|
||||
}
|
||||
|
||||
let fv = FeatureVector {
|
||||
values: vec![0.3; 56],
|
||||
values: vec![0.3; ml_core::state_layout::STATE_DIM],
|
||||
timestamp: 1700000000,
|
||||
};
|
||||
let pred1 = adapter.predict(&fv).expect("first predict");
|
||||
|
||||
Reference in New Issue
Block a user