pytorch
b0a372e1 - fix specify_constraints's signature when exporting model (#100739)

Commit
1 year ago
fix specify_constraints's signature when exporting model (#100739) Currently, when f is a Module, the signature should be the "forward" methods signature. For example, ```python class Module(torch.nn.Module): def forward(self, x): return x.sin() mod = Module() x = torch.ones([3, 3]) torch._dynamo.export(mod, x, constraints=[dynamic_dim(x, 0)]) ``` Previously, it prints following: ```python def specify_constraints(*args, **kwargs): return [ 2 <= dynamic_dim(x, 0), 2 <= dynamic_dim(x, 1), ] ``` After the pr, it prints: ```python def specify_constraints(x): return [ 2 <= dynamic_dim(x, 0), 2 <= dynamic_dim(x, 1), ] ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/100739 Approved by: https://github.com/avikchaudhuri
Author
Committer
Parents
Loading