Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ONNX] Support aten::scatter_reduce #84260

Closed
vanly89 opened this issue Aug 30, 2022 · 3 comments
Closed

[ONNX] Support aten::scatter_reduce #84260

vanly89 opened this issue Aug 30, 2022 · 3 comments
Assignees
Labels
module: onnx Related to torch.onnx onnx-triaged triaged by ONNX team triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@vanly89
Copy link

vanly89 commented Aug 30, 2022

🐛 Describe the bug

Hi, experts,
Thanks for your dedication to the great project pytorch. When I uesd torch.onnx.export() function to try to convert .pt model to .onnx model, I got the an error : " ONNX export failure: Exporting the operator ::scatter_reduce to ONNX opset version 16 is not supported. ". Yes, I used torch.scatter_reduce ops in my model. So, did torch.onnx.export support converting scatter_reduce operator to onnx format, if not, is there any other way to replace scatter_reduce operator that torch.onnx export function supported ? Could you so nice to give some guidiance?
I simplified my code as follows:

import torch
import torch.nn as nn


class Model(nn.Module):
    def __init__(self):
        super(Model, self).__init__()

    def forward(self, x, index, input):
        y_max = input.scatter_reduce(0, index, x, reduce='amax')
        y_sum = input.scatter_reduce(0, index, x, reduce='sum')
        return y_max, y_sum


model = Model()
model.eval()

src = torch.tensor([1., 2., 3., 4., 5., 6.])
index = torch.tensor([0, 1, 0, 1, 2, 1])
input = torch.tensor([1., 2., 3., 8.])
torch.onnx.export(model,
                  (src, index, input),
                  'model.onnx',
                  opset_version=16
                  )

Versions

[pip3] numpy==1.19.0
[pip3] pytorch-lightning==1.7.2
[pip3] torch==1.13.0.dev20220828+cu113
[pip3] torch-cluster==1.6.0
[pip3] torch-geometric==2.1.0
[pip3] torch-scatter==2.0.9
[pip3] torch-sparse==0.6.15
[pip3] torch-spline-conv==1.2.1
[pip3] torchaudio==0.12.1
[pip3] torchmetrics==0.9.3
[pip3] torchvision==0.13.1
[conda] blas 1.0 mkl
[conda] cudatoolkit 11.3.1 h2bc3f7f_2
[conda] ffmpeg 4.3 hf484d3e_0 pytorch
[conda] mkl 2021.4.0 h06a4308_640
[conda] mkl-service 2.4.0 py38h7f8727e_0
[conda] mkl_fft 1.3.1 py38hd3c417c_0
[conda] mkl_random 1.2.2 py38h51133e4_0
[conda] numpy 1.19.0 pypi_0 pypi
[conda] pytorch-lightning 1.7.2 pypi_0 pypi
[conda] pytorch-mutex 1.0 cuda pytorch
[conda] torch 1.13.0.dev20220828+cu113 pypi_0 pypi
[conda] torch-cluster 1.6.0 pypi_0 pypi
[conda] torch-geometric 2.1.0 pypi_0 pypi
[conda] torch-scatter 2.0.9 pypi_0 pypi
[conda] torch-sparse 0.6.15 pypi_0 pypi
[conda] torch-spline-conv 1.2.1 pypi_0 pypi
[conda] torchaudio 0.12.1 py38_cu113 pytorch
[conda] torchmetrics 0.9.3 pypi_0 pypi
[conda] torchvision 0.13.1 py38_cu113 pytorch

@vanly89 vanly89 changed the title ONNX export failure: Exporting the operator ::scatter_reduce to ONNX opset version 16 is not supported. 【ONNX】ONNX export failure: Exporting the operator ::scatter_reduce to ONNX opset version 16 is not supported. Aug 31, 2022
@malfet malfet added the module: onnx Related to torch.onnx label Aug 31, 2022
@soulitzer soulitzer added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Sep 1, 2022
@justinchuby justinchuby changed the title 【ONNX】ONNX export failure: Exporting the operator ::scatter_reduce to ONNX opset version 16 is not supported. [ONNX] Support aten::scatter_reduce Sep 7, 2022
@justinchuby justinchuby added the onnx-triaged triaged by ONNX team label Sep 7, 2022
@justinchuby
Copy link
Collaborator

justinchuby commented Sep 7, 2022

Thanks for your question. scatter_reduce is not yet supported by torch.onnx. We have added it to our list. #84496

We welcome your contribution!

@ThomasRetornaz
Copy link

Thanks for this great project
Important note this limitation continue to exist in torch2.0/opset18 and block pygeometric export eg of a simple GATConv
Which is very annoying

@titaiwangms titaiwangms self-assigned this May 22, 2023
titaiwangms added a commit that referenced this issue May 25, 2023
Fixes #84260 

`reduce='mean'` is not supported, as it's not in ONNX spec (onnx/onnx#5100)

[ghstack-poisoned]
titaiwangms added a commit that referenced this issue May 25, 2023
Fixes #84260 

`reduce='mean'` is not supported, as it's not in ONNX spec (onnx/onnx#5100)

[ghstack-poisoned]
titaiwangms added a commit that referenced this issue May 25, 2023
Fixes #84260 

`reduce='mean'` is not supported, as it's not in ONNX spec (onnx/onnx#5100)

[ghstack-poisoned]
titaiwangms added a commit that referenced this issue May 25, 2023
Fixes #84260 

`reduce='mean'` is not supported, as it's not in ONNX spec (onnx/onnx#5100)

[ghstack-poisoned]
titaiwangms added a commit that referenced this issue May 25, 2023
Fixes #84260 

`reduce='mean'` is not supported, as it's not in ONNX spec (onnx/onnx#5100)

[ghstack-poisoned]
titaiwangms added a commit that referenced this issue May 25, 2023
Fixes #84260 

`reduce='mean'` is not supported, as it's not in ONNX spec (onnx/onnx#5100)

[ghstack-poisoned]
titaiwangms added a commit that referenced this issue May 25, 2023
Fixes #84260 

`reduce='mean'` is not supported, as it's not in ONNX spec (onnx/onnx#5100)

[ghstack-poisoned]
titaiwangms added a commit that referenced this issue May 25, 2023
Fixes #84260 

`reduce='mean'` is not supported, as it's not in ONNX spec (onnx/onnx#5100)

[ghstack-poisoned]
titaiwangms added a commit that referenced this issue May 25, 2023
Fixes #84260 

`reduce='mean'` is not supported, as it's not in ONNX spec (onnx/onnx#5100)

[ghstack-poisoned]
titaiwangms added a commit that referenced this issue May 25, 2023
Fixes #84260 

`reduce='mean'` is not supported, as it's not in ONNX spec (onnx/onnx#5100)

[ghstack-poisoned]
titaiwangms added a commit that referenced this issue May 25, 2023
Fixes #84260 

`reduce='mean'` is not supported, as it's not in ONNX spec (onnx/onnx#5100)

[ghstack-poisoned]
titaiwangms added a commit that referenced this issue May 25, 2023
Fixes #84260 

`reduce='mean'` is not supported, as it's not in ONNX spec (onnx/onnx#5100)

[ghstack-poisoned]
@LTsommer
Copy link

Thanks for this great project Important note this limitation continue to exist in torch2.0/opset18 and block pygeometric export eg of a simple GATConv Which is very annoying

Same problem, so have you solved it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: onnx Related to torch.onnx onnx-triaged triaged by ONNX team triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

No branches or pull requests

7 participants