Skip to content

Shape mismatch due to shape replication while initializing sym_sizes_ for dynamic shape #3839

Closed
@miladm

Description

@miladm

🐛 Bug

While debugging issues ##3828 I learnt the solution to address the problem is to replace initializing sym_sizes_ in tensor_impl constructor with one that takes advantage of a method like SetupSizeProperties for SymInt objects. In doing so, I am dealing with the following new error that appears to suggest a tensor updating its shape data structures more than once. This failure occurs across over 50 tests.

======================================================================
ERROR: test_Dropout_xla (__main__.TestNNDeviceTypeXLA)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/conda/lib/python3.7/site-packages/torch/testing/_internal/common_device_type.py", line 390, in instantiated_test
    raise rte
  File "/opt/conda/lib/python3.7/site-packages/torch/testing/_internal/common_device_type.py", line 377, in instantiated_test
    result = test(self, **param_kwargs)
  File "/workspace/pytorch/xla/test/../../test/test_nn.py", line 14397, in test_Dropout
    self._test_dropout(nn.Dropout, device, input)
  File "/workspace/pytorch/xla/test/../../test/test_nn.py", line 12997, in _test_dropout
    output.backward(input)
  File "/opt/conda/lib/python3.7/site-packages/torch/_tensor.py", line 485, in backward
    self, gradient, retain_graph, create_graph, inputs=inputs
  File "/opt/conda/lib/python3.7/site-packages/torch/autograd/__init__.py", line 184, in backward
    grad_tensors_ = _make_grads(tensors, grad_tensors_, is_grads_batched=False)
  File "/opt/conda/lib/python3.7/site-packages/torch/autograd/__init__.py", line 72, in _make_grads
    + str(out_shape) + ".")
RuntimeError: Mismatch in shape: grad_output[0] has a shape of torch.Size([1000]) and output[0] has a shape of torch.Size([1000, 1000]).

Metadata

Metadata

Assignees

Labels

dynamismDynamic Shape Features

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions