From e97fd7a025d7fe42b8b2a4720b05d5f83cd3391e Mon Sep 17 00:00:00 2001 From: Masonmason Date: Thu, 17 Jul 2025 10:11:38 +0800 Subject: [PATCH] fix: Resolve remaining numpy array comparison errors in MultiDongle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix ambiguous truth value error in get_latest_inference_result method - Fix ambiguous truth value error in postprocess function - Replace direct array evaluation with explicit length checks - Use proper None checks instead of truthy evaluation on numpy arrays 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- cluster4npu_ui/core/functions/Multidongle.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cluster4npu_ui/core/functions/Multidongle.py b/cluster4npu_ui/core/functions/Multidongle.py index 5ebed2a..3031438 100644 --- a/cluster4npu_ui/core/functions/Multidongle.py +++ b/cluster4npu_ui/core/functions/Multidongle.py @@ -426,7 +426,7 @@ class MultiDongle: retrieval_successful = False break - if retrieval_successful and inf_node_output_list: + if retrieval_successful and len(inf_node_output_list) > 0: # Process output nodes if output_descriptor.header.num_output_node == 1: raw_output_array = inf_node_output_list[0].flatten() @@ -690,7 +690,7 @@ def postprocess(raw_model_output: list) -> float: Post-processes the raw model output. Assumes the model output is a list/array where the first element is the desired probability. """ - if raw_model_output and len(raw_model_output) > 0: + if raw_model_output is not None and len(raw_model_output) > 0: probability = raw_model_output[0] return float(probability) return 0.0 # Default or error value