File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2768,13 +2768,6 @@ def scale_by_level(
27682768 chi_factors = []
27692769 flat_indices = []
27702770 for elem , indices in zip (nested_values , nested_indices ):
2771-
2772- # Reach the outermost level
2773- if not isinstance (indices , list ) or (
2774- len (indices ) == 1 and not isinstance (indices [0 ], list )
2775- ):
2776- return scaling_vector
2777-
27782771 flat_indices .append (np .asarray (list (flatten (indices ))))
27792772 residuals = np .asarray (list (flatten (elem )))
27802773 phi_d = np .vdot (residuals , residuals )
@@ -2795,7 +2788,14 @@ def scale_by_level(
27952788 scaling_vector [group_ind ] = np .maximum (
27962789 ratio , scale * scaling_vector [group_ind ]
27972790 )
2798- scaling_vector = self .scale_by_level (elem , indices , ratio , scaling_vector )
2791+
2792+ # Continue one level deeper if more nesting
2793+ if isinstance (indices , list ) and (
2794+ len (indices ) > 1 and isinstance (indices [0 ], list )
2795+ ):
2796+ scaling_vector = self .scale_by_level (
2797+ elem , indices , ratio , scaling_vector
2798+ )
27992799
28002800 return scaling_vector
28012801
You can’t perform that action at this time.
0 commit comments