8000 Fix `'TensorBox' object has no attribute 'is_input_buffer'` (#152980) · pytorch/pytorch@180cbf4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 180cbf4

Browse files
janselpytorchmergebot
authored andcommitted
Fix 'TensorBox' object has no attribute 'is_input_buffer' (#152980)
Summary: Fix for https://fb.workplace.com/groups/1075192433118967/permalink/1664491270855744/ Test Plan: Used reproducer from D74262030 Differential Revision: D74270090 Pull Request resolved: #152980 Approved by: https://github.com/Skylion007, https://github.com/eellison
1 parent d808a3e commit 180cbf4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

torch/_inductor/ir.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,12 @@ def maybe_get_name(self) -> Optional[str]:
657657
except NotImplementedError:
658658
return None
659659

660+
def is_input_buffer(self) -> bool:
661+
try:
662+
return self.get_name() in V.graph.graph_inputs
663+
except NotImplementedError:
664+
return False
665+
660666
def has_large_inner_fn(self, threshold: Optional[int] = None) -> bool:
661667
return False
662668

@@ -7261,6 +7267,9 @@ def realize_hint(self) -> None:
72617267
def unwrap_view(self) -> IRNode:
72627268
return self.data.unwrap_view()
72637269

7270+
def is_input_buffer(self) -> bool:
7271+
return self.data.is_input_buffer()
7272+
72647273
def freeze_layout(self) -> None:
72657274
return self.data.freeze_layout()
72667275

@@ -7380,7 +7389,7 @@ def create(data): # type: ignore[no-untyped-def]
73807389

73817390

73827391
class StorageBox(MutableBox):
7383-
def is_input_buffer(self): # type: ignore[no-untyped-def]
7392+
def is_input_buffer(self) -> bool:
73847393
if isinstance(self.data, (InputBuffer, ReinterpretView)):
73857394
return self.data.get_name() in V.graph.graph_inputs
73867395
return False

0 commit comments

Comments
 (0)
0