Skip to content

Commit 79e9b79

Browse files
tugsbayasgalanfacebook-github-bot
authored andcommitted
Remove torch._constrain_as_value (#3731)
Summary: Pull Request resolved: #3731 X-link: pytorch/pytorch#127103 This API doesn't do anything useful and should be subsumed by torch._check. Reviewed By: angelayi Differential Revision: D57786740 fbshipit-source-id: 739ecf981e843712c418fa660f7a01f3d0b5b6cb
1 parent b24aa49 commit 79e9b79

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

exir/program/test/test_program.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,8 @@ def test_constraint_present_after_dce(self):
219219
class M(torch.nn.Module):
220220
def forward(self, x, y):
221221
z = y.item()
222-
torch._constrain_as_value(z, 0, 4)
222+
torch._check(z > 0)
223+
torch._check(z < 4)
223224
return x[z : z + y.shape[0]]
224225

225226
ep = torch.export.export(M(), (torch.randn(10), torch.tensor([3])))

exir/verification/test/test_verifier.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ def test_edge_verifier_enablement(self) -> None:
3737
class M(torch.nn.Module):
3838
def forward(self, x, y):
3939
z = y.item()
40-
torch._constrain_as_value(z, 0, 4)
40+
torch._check(z > 0)
41+
torch._check(z < 4)
4142
return x[z : z + y.shape[0]]
4243

4344
ep = torch.export.export(M(), (torch.randn(10), torch.tensor([3])))

0 commit comments

Comments
 (0)