Skip to content

Commit 2f8d4b9

Browse files
committed
pick searchsorted from master
1 parent e4ad06f commit 2f8d4b9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pytorch_lightning/loops/utilities.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,5 +166,5 @@ def _get_active_optimizers(
166166
current_place_in_loop = batch_idx % optimizers_loop_length
167167

168168
# find optimizer index by looking for the first {item > current_place} in the cumsum list
169-
opt_idx = int(np.argmax(freq_cumsum > current_place_in_loop))
169+
opt_idx = np.searchsorted(freq_cumsum, current_place_in_loop, side="right")
170170
return [(opt_idx, optimizers[opt_idx])]

0 commit comments

Comments
 (0)