From 33bcc44bd4804c3cf4c8ed485f1dd6aa727dd4f1 Mon Sep 17 00:00:00 2001 From: jgrusewski Date: Wed, 11 Mar 2026 09:38:12 +0100 Subject: [PATCH] =?UTF-8?q?docs:=20fix=20Task=206=20min/max=20API=20?= =?UTF-8?q?=E2=80=94=20candle=20min(D)/max(D)=20returns=20Tensor=20not=20t?= =?UTF-8?q?uple?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In candle-core (git 671de1d), min(D) and max(D) return Result, not Result<(Tensor, Tensor)>. Use flatten_all() then min(0)/max(0) for scalar reduction instead of the tuple destructuring pattern. Co-Authored-By: Claude Opus 4.6 --- .../plans/2026-03-11-cuda-backtest-gpu-residency-plan.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/plans/2026-03-11-cuda-backtest-gpu-residency-plan.md b/docs/plans/2026-03-11-cuda-backtest-gpu-residency-plan.md index 27b089e99..f5a165154 100644 --- a/docs/plans/2026-03-11-cuda-backtest-gpu-residency-plan.md +++ b/docs/plans/2026-03-11-cuda-backtest-gpu-residency-plan.md @@ -721,9 +721,12 @@ fn compute_q_diagnostics_gpu( // Batch all gap stats into a single tensor to minimize readbacks: // [mean_gap, min_gap, max_gap] — one to_vec1 instead of three to_scalar - let mean_gap = gaps.mean_all()?; // [1] - let min_gap = gaps.min(0)?.0.min(0)?.0; // scalar tensor - let max_gap = gaps.max(0)?.0.max(0)?.0; // scalar tensor + // Note: In candle-core (git 671de1d), min(D)/max(D) return Result, + // NOT Result<(Tensor, Tensor)>. Flatten first for scalar reduction. + let gaps_flat = gaps.flatten_all()?; + let mean_gap = gaps_flat.mean_all()?; // scalar tensor + let min_gap = gaps_flat.min(0)?; // scalar tensor + let max_gap = gaps_flat.max(0)?; // scalar tensor let gap_stats = Tensor::cat( &[&mean_gap.unsqueeze(0)?, &min_gap.unsqueeze(0)?, &max_gap.unsqueeze(0)?], 0 )?;