Skip to content

Commit 7c80cd3

Browse files
JacobSzwejbkafacebook-github-bot
authored andcommitted
Fix broken emitter test (#1892)
Summary: Pull Request resolved: #1892 Been broken for a while I imagine off of some symint checks. This adds the info needed Reviewed By: tarun292 Differential Revision: D53581212 fbshipit-source-id: 015ef44862189d389b030d927dd858bd4d24984a
1 parent f57ca1e commit 7c80cd3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

exir/emit/test/test_emit.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
KernelTypes,
3636
MoveCall,
3737
Null,
38+
OptionalTensorList,
3839
Program,
3940
String,
4041
Tensor,
@@ -538,12 +539,12 @@ def test_optional_tensor_list(self) -> None:
538539
class Foo(torch.nn.Module):
539540
def forward(self, x: torch.Tensor) -> torch.Tensor:
540541
a = torch.nonzero(x)
542+
torch._constrain_as_size(a.shape[0], min=1)
541543
b = torch.ops.aten.index.Tensor(x, [a])
542544
return b
543545

544546
f = Foo()
545-
546-
x = (torch.randn(3, 2),)
547+
x = (torch.triu(torch.ones(2, 2)),)
547548
program = (
548549
to_edge(
549550
export(f, x),
@@ -552,6 +553,9 @@ def forward(self, x: torch.Tensor) -> torch.Tensor:
552553
.to_executorch()
553554
.executorch_program
554555
)
556+
self.assertTrue(
557+
isinstance(program.execution_plan[0].values[3].val, OptionalTensorList)
558+
)
555559
self._assertCallLength(program, 0, 3)
556560
self._assertCallLength(program, 1, 4)
557561

0 commit comments

Comments
 (0)