Edge case in weight setting that only occurs when there's a single non-zero weight:
- In
weight_utils.process_weights_for_netuid , non-zero weight indices are extracted by calling np.argwhere(weights > 0).squeeze(). (line 142)
- In the case where there is only a single weight with a non-zero value, this returns an array scalar (which is an unsized object, i.e. you cannot call
len on it).
- The resulting variable
non_zero_weight_idx is used to index into uids and weights, which again produces an array scaler (lines 143-144)
- Downstream code calls
len on non_zero_weights, which fails in the case of it being an array scaler (line 168)
Toy recreation of the issue:
