Skip to content

Commit

Permalink
[dynamo] do not raise an unimplemented error with boolean masking set…
Browse files Browse the repository at this point in the history
…item (pytorch#134902)

Cudagraph breaks on boolean masking setitem, however the code runs fine. There is no need to raise an unimplemented error here, since it already warns that its an incompatible op.

Fixes pytorch#134241

Pull Request resolved: pytorch#134902
Approved by: https://github.com/jansel, https://github.com/henrylhtsang
  • Loading branch information
sudoRicheek authored and pytorchmergebot committed Oct 10, 2024
1 parent 079f909 commit 080f02a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
5 changes: 1 addition & 4 deletions test/dynamo/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -4565,10 +4565,7 @@ def forward(self, x, b, y):
return pytree.tree_unflatten([x], self._out_spec)""", # NOQA: B950
)

with self.assertRaisesRegex(
torch._dynamo.exc.Unsupported, "boolean masking setitem backwards"
):
gm, _ = torch._dynamo.export(fn)(x, b, y)
gm, _ = torch._dynamo.export(fn)(x, b, y)

def test_dynamo_list_index(self):
def fn(x, in_list):
Expand Down
9 changes: 0 additions & 9 deletions torch/_dynamo/variables/tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -874,15 +874,6 @@ def has_bool_key(v):
else:
return False

if (
has_bool_key(key)
and isinstance(value, TensorVariable)
and value.requires_grad
and torch.is_grad_enabled()
):
unimplemented(
"boolean masking setitem backwards, see https://github.com/pytorch/pytorch/issues/114123"
)
from ..symbolic_convert import InstructionTranslator

tx = InstructionTranslator.current_tx()
Expand Down

0 comments on commit 080f02a

Please sign in to comment.