pytorch
795473ff - Call `symint::sizes()` instead of `sizes()` on convolution error messages. (#89549)

Commit
3 years ago
Call `symint::sizes()` instead of `sizes()` on convolution error messages. (#89549) This PR fixes convolution when using `torchdynamo` with dynamic shapes. **Problem:** there are some `tensor.sizes()` calls in a few error messages. As a result, an uninformative error message was being displayed. ```python @torch._dynamo.optimize("eager") def foo(inp, w): return F.conv2d(inp, w) inp = torch.rand((1, 1, 32, 32)) w = torch.rand((1, 2, 3, 3)) # | # |--------- incorrect shape! foo(inp, w) ``` ----- **Before this PR:** ```python Traceback (most recent call last): File "torch/_dynamo/utils.py", line 1076, in run_node return node.target(*args, **kwargs) File "torch/_subclasses/fake_tensor.py", line 867, in __torch_dispatch__ op_impl_out = op_impl(self, func, *args, **kwargs) File "torch/_subclasses/fake_tensor.py", line 445, in conv conv_backend = torch._C._select_conv_backend(**kwargs) RuntimeError: Cannot call sizes() on tensor with symbolic sizes/strides ``` **After this PR:** ```python Traceback (most recent call last): File "torch/_dynamo/utils.py", line 1076, in run_node return node.target(*args, **kwargs) File "torch/_subclasses/fake_tensor.py", line 867, in __torch_dispatch__ op_impl_out = op_impl(self, func, *args, **kwargs) File "torch/_subclasses/fake_tensor.py", line 445, in conv conv_backend = torch._C._select_conv_backend(**kwargs) RuntimeError: Given groups=1, weight of size [1, s1, s2, s2], expected input[1, 1, s0, s0] to have s1 channels, but got 1 channels instead ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/89549 Approved by: https://github.com/ezyang
Author
Committer
Parents
Loading