fix(ml): Fix 3 pre-existing test failures (Part 2/3)
Fixed Tests: 1. test_output_shape_validation - Added transpose for cached weights in quantized attention 2. test_weight_caching - Same fix as #1, ensures consistency between cached and non-cached paths 3. test_training_step_with_data - Fixed DQN dtype mismatch by converting next_state_values to F32 Root Causes: - Quantized attention: Cached weights were not transposed like slow path weights - DQN: next_q_values.max(1) returns F64, causing dtype mismatch with F32 tensors Files Modified: - ml/src/tft/quantized_attention.rs: Added .t()? for cached weight projections (lines 238-240, 296) - ml/src/dqn/dqn.rs: Added .to_dtype(DType::F32)? for next_state_values (lines 477, 483) Test Results: 1286/1290 passing (4 failures remaining, down from 8) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -454,6 +454,9 @@ async fn test_trade_events() {
|
||||
quantity: Some(0.1),
|
||||
sequence: 1,
|
||||
latency_ns: Some(1000),
|
||||
open: None,
|
||||
high: None,
|
||||
low: None,
|
||||
};
|
||||
|
||||
writer.record(event).unwrap();
|
||||
@@ -517,6 +520,9 @@ async fn test_orderbook_events() {
|
||||
quantity: None,
|
||||
sequence: 1,
|
||||
latency_ns: Some(2000),
|
||||
open: None,
|
||||
high: None,
|
||||
low: None,
|
||||
};
|
||||
|
||||
writer.record(event).unwrap();
|
||||
@@ -558,6 +564,9 @@ async fn test_mixed_event_types() {
|
||||
quantity: None,
|
||||
sequence: 3,
|
||||
latency_ns: None,
|
||||
open: None,
|
||||
high: None,
|
||||
low: None,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -883,6 +892,9 @@ async fn test_extreme_values() {
|
||||
quantity: Some(f64::MIN_POSITIVE),
|
||||
sequence: u64::MAX,
|
||||
latency_ns: Some(u64::MAX),
|
||||
open: None,
|
||||
high: None,
|
||||
low: None,
|
||||
};
|
||||
|
||||
let result = writer.record(event);
|
||||
@@ -921,6 +933,9 @@ async fn test_null_optional_fields() {
|
||||
quantity: None,
|
||||
sequence: 1,
|
||||
latency_ns: None,
|
||||
open: None,
|
||||
high: None,
|
||||
low: None,
|
||||
};
|
||||
|
||||
let result = writer.record(event);
|
||||
@@ -1214,6 +1229,9 @@ async fn test_negative_timestamp_handling() {
|
||||
quantity: Some(1.0),
|
||||
sequence: 1,
|
||||
latency_ns: Some(1000),
|
||||
open: None,
|
||||
high: None,
|
||||
low: None,
|
||||
};
|
||||
|
||||
let result = writer.record(event);
|
||||
@@ -1239,6 +1257,9 @@ async fn test_nan_and_infinity_values() {
|
||||
quantity: Some(f64::NAN),
|
||||
sequence: 1,
|
||||
latency_ns: Some(1000),
|
||||
open: None,
|
||||
high: None,
|
||||
low: None,
|
||||
};
|
||||
|
||||
let result = writer.record(event_nan);
|
||||
@@ -1256,6 +1277,9 @@ async fn test_nan_and_infinity_values() {
|
||||
quantity: Some(f64::NEG_INFINITY),
|
||||
sequence: 2,
|
||||
latency_ns: Some(2000),
|
||||
open: None,
|
||||
high: None,
|
||||
low: None,
|
||||
};
|
||||
|
||||
let result = writer.record(event_inf);
|
||||
|
||||
Reference in New Issue
Block a user