fix(ml): mamba2 hyperopt tensors created on GPU instead of CPU

Replace &Device::Cpu with &self.device for input and target tensor
creation in Mamba2 hyperopt adapter. Avoids unnecessary CPU→GPU
transfer during hyperparameter optimization.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jgrusewski
2026-03-02 18:03:10 +01:00
parent 85138e2fbd
commit 129c2f19b8

View File

@@ -617,13 +617,13 @@ impl Mamba2Trainer {
// Normalize target to [0,1]
let normalized_target = (target_price - target_min) / (target_max - target_min);
let input_tensor = Tensor::new(sequence.as_slice(), &Device::Cpu)?.reshape((
let input_tensor = Tensor::new(sequence.as_slice(), &self.device)?.reshape((
1,
seq_len,
self.d_model,
))?;
let target_tensor =
Tensor::new(&[normalized_target], &Device::Cpu)?.reshape((1, 1, 1))?;
Tensor::new(&[normalized_target], &self.device)?.reshape((1, 1, 1))?;
feature_sequences.push((input_tensor, target_tensor));
}