diff --git a/template/base/utils/weight_utils.py b/template/base/utils/weight_utils.py index 06fc0d4d..ab1484fa 100644 --- a/template/base/utils/weight_utils.py +++ b/template/base/utils/weight_utils.py @@ -140,6 +140,9 @@ def process_weights_for_netuid( # Find all non zero weights. non_zero_weight_idx = np.argwhere(weights > 0).squeeze() + if non_zero_weight_idx.ndim == 0: + non_zero_weight_idx = non_zero_weight_idx.reshape((1,)) + non_zero_weight_uids = uids[non_zero_weight_idx] non_zero_weights = weights[non_zero_weight_idx] if non_zero_weights.size == 0 or metagraph.n < min_allowed_weights: