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:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user