From 047d7771f352870aa412a03ec9b1ac72cef44e07 Mon Sep 17 00:00:00 2001 From: Nicholas Curtis Date: Thu, 9 May 2024 14:59:57 -0400 Subject: [PATCH] Add fix for case where we pass a single 'nan' value to to_avg This is triggered by doing e.g., analyze -p -k -n per_kernel -b 17 18 Manifests as e.g.: ``` ERROR [analysis] 'float' object has no attribute 'empty' ``` because of: https://github.com/ROCm/omniperf/blob/d1ee2ec8709b21f2e72536cc14dba8ac2f8621ab/src/utils/parser.py#L135 Instead, we first check whether numpy thinks the whole array is nan's, and bail early if so Signed-off-by: Nicholas Curtis --- src/utils/parser.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/utils/parser.py b/src/utils/parser.py index 5ca591eaae..654057b400 100644 --- a/src/utils/parser.py +++ b/src/utils/parser.py @@ -132,6 +132,8 @@ def to_max(*args): def to_avg(a): if str(type(a)) == "": return np.nan + elif np.isnan(a).all(): + return np.nan elif a.empty: return np.nan elif isinstance(a, pd.core.series.Series):