Skip to content

Commit 7e449e8

Browse files
ezyangpytorchmergebot
authored andcommitted
Fix some silly Inductor bugs (pytorch#92997)
Should probably figure out how to get type checking going, would have caught these cases. Discovered in pursuit of pytorch#91719 though this is not enough. Signed-off-by: Edward Z. Yang <[email protected]> Pull Request resolved: pytorch#92997 Approved by: https://github.com/Chillee
1 parent abcaa05 commit 7e449e8

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

torch/_inductor/mkldnn.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,9 @@ def fused_linear_binary_eval(linear: nn.Module, attr: str, input_size: list):
488488

489489
def mkldnn_fuse_fx(gm: torch.fx.GraphModule, example_inputs):
490490
is_cpu = all(
491-
example_input.device == torch.device("cpu") for example_input in example_inputs
491+
example_input.device == torch.device("cpu")
492+
for example_input in example_inputs
493+
if isinstance(example_input, torch.Tensor)
492494
)
493495

494496
# make sure the autograd is disabled.

torch/_inductor/overrides.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ def replace_fx(gm: torch.fx.GraphModule):
6363

6464
def fuse_fx(gm: torch.fx.GraphModule, example_inputs):
6565
is_cpu = all(
66-
example_input.device == torch.device("cpu") for example_input in example_inputs
66+
example_input.device == torch.device("cpu")
67+
for example_input in example_inputs
68+
if isinstance(example_input, torch.Tensor)
6769
)
6870

6971
fake_mode = fake_mode_from_tensors(example_inputs)

0 commit comments

Comments
 (0)