"torchvision/models/vscode:/vscode.git/clone" did not exist on "dec8628d92c52e9b0d3f8816037870907b7d99f2"
Commit 4cdea1cc authored by Taylor Robie's avatar Taylor Robie
Browse files

skip bisection when it is not needed

parent d569b531
...@@ -826,6 +826,10 @@ class BisectionDataConstructor(BaseDataConstructor): ...@@ -826,6 +826,10 @@ class BisectionDataConstructor(BaseDataConstructor):
(neg_item_choice - self._total_negatives[right_index]) (neg_item_choice - self._total_negatives[right_index])
)[use_shortcut] )[use_shortcut]
if np.all(use_shortcut):
# The bisection code is ill-posed when there are no elements.
return output
not_use_shortcut = np.logical_not(use_shortcut) not_use_shortcut = np.logical_not(use_shortcut)
left_index = left_index[not_use_shortcut] left_index = left_index[not_use_shortcut]
right_index = right_index[not_use_shortcut] right_index = right_index[not_use_shortcut]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment