Skip to content

Commit

Permalink
Update on "[ONNX] handle aten::_set_item on Dict in convertInplaceOps…
Browse files Browse the repository at this point in the history
…AndTrackAlias (#58317)"


It seems the JIT produces an output for aten::_set_item on lists but
not on dicts. Previously the code would crash because it assumed it
was operating on a list.

The different behavior can be seen with the following test:

```python
class DictModule(torch.nn.Module):
    def forward(self, x_in: torch.Tensor) -> typing.Dict[str, torch.Tensor]:
        x_out = {}
        x_out["test_key_out"] = x_in
        return x_out

x_in = torch.tensor(1)
dms = torch.jit.script(DictModule())
torch.onnx.export(dms, (x_in,), "/dev/null", example_outputs=(dms(x_in),))
```

Before this change:
`RuntimeError: outputs_.size() == 1INTERNAL ASSERT FAILED at "../torch/csrc/jit/ir/ir.h":452, please report a bug to PyTorch.`

After this change:
`RuntimeError: Exporting the operator prim_DictConstruct to ONNX opset version 9 is not supported. Please feel free to request support or submit a pull request on PyTorch GitHub.`

This is a more useful error message.

Co-authored-by: Gary Miguel <garymiguel@microsoft.com>

Differential Revision: [D28714804](https://our.internmc.facebook.com/intern/diff/D28714804)

[ghstack-poisoned]
  • Loading branch information
BowenBao committed May 26, 2021
2 parents ef8bd1b + f6e31db commit b142dcf
Show file tree
Hide file tree
Showing 533 changed files with 16,563 additions and 6,482 deletions.
4 changes: 4 additions & 0 deletions .circleci/cimodel/data/binary_build_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ def __init__(self, parent, package_format, python_versions):
self.props["python_versions"] = python_versions
self.props["package_format"] = package_format

# XXX Disabling conda for 11.3 as there's currently no appropriate cudatoolkit available
if package_format == "conda":
self.props["gpu_versions"] = filter(lambda x: x != "cuda113", self.find_prop("gpu_versions"))

def get_children(self):
if self.find_prop("os_name") == "linux":
return [LinuxGccConfigNode(self, v) for v in LINUX_GCC_CONFIG_VARIANTS[self.find_prop("package_format")]]
Expand Down
1 change: 1 addition & 0 deletions .circleci/cimodel/data/dimensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
CUDA_VERSIONS = [
"102",
"111",
"113",
]

ROCM_VERSIONS = [
Expand Down
7 changes: 2 additions & 5 deletions .circleci/cimodel/data/windows_build_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,13 @@ def render(self):
WindowsJob(None, _VC2019, CudaVersion(10, 1), master_only=True),
WindowsJob(1, _VC2019, CudaVersion(10, 1), master_only=True),
WindowsJob(2, _VC2019, CudaVersion(10, 1), master_only=True),
# VS2019 CUDA-10.1 force on cpu
WindowsJob(1, _VC2019, CudaVersion(10, 1), force_on_cpu=True, master_only=True),
# VS2019 CUDA-11.1
WindowsJob(None, _VC2019, CudaVersion(11, 1)),
WindowsJob(1, _VC2019, CudaVersion(11, 1), master_only=True),
WindowsJob(2, _VC2019, CudaVersion(11, 1), master_only=True),
WindowsJob('_azure_multi_gpu', _VC2019, CudaVersion(11, 1), multi_gpu=True, master_and_nightly=True),
# VS2019 CPU-only
WindowsJob(None, _VC2019, None),
WindowsJob(1, _VC2019, None),
WindowsJob(2, _VC2019, None),
WindowsJob(1, _VC2019, CudaVersion(10, 1), force_on_cpu=True, master_only=True),
]


Expand Down
Loading

0 comments on commit b142dcf

Please sign in to comment.