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

Cross Op #2683

Open
mtngld opened this issue Mar 25, 2020 · 10 comments
Open

Cross Op #2683

mtngld opened this issue Mar 25, 2020 · 10 comments
Labels
enhancement Request for new feature or operator operator Issues related to ONNX operators

Comments

@mtngld
Copy link

mtngld commented Mar 25, 2020

Currently, ONNX does not include the Cross op.

PyTorch cross:
https://pytorch.org/docs/stable/torch.html#torch.cross

TF cross:
https://www.tensorflow.org/api_docs/python/tf/linalg/cross

@ebarsoum ebarsoum added the operator Issues related to ONNX operators label Apr 8, 2020
@ebarsoum
Copy link
Contributor

ebarsoum commented Apr 8, 2020

Which model need it?

@mtngld
Copy link
Author

mtngld commented Apr 8, 2020

It is used often for geometric related models, for example in this pytorch_geometric library

https://github.com/rusty1s/pytorch_geometric

https://github.com/rusty1s/pytorch_geometric/blob/5692a8613d9340c76545e59b4d37cd4ced6d340e/torch_geometric/nn/conv/ppf_conv.py#L11

@askhade askhade added the enhancement Request for new feature or operator label Jun 19, 2020
@ALLinLLM
Copy link

ALLinLLM commented Feb 23, 2021

@mtngld I met the same problem and work around it by the following code

        # normal = tu.cross(tv, dim=3) 
        normal = torch.stack((
        tu[:,:,:,1]*tv[:,:,:,2] - tu[:,:,:,2]*tv[:,:,:,1],
        tu[:,:,:,2]*tv[:,:,:,0] - tu[:,:,:,0]*tv[:,:,:,2],
        tu[:,:,:,0]*tv[:,:,:,1] - tu[:,:,:,1]*tv[:,:,:,0]), dim=3)
        # print("cross all close", torch.allclose(normal, normal2))

the code above is following the cross formula on wikipedia.

BTW, @ebarsoum In the 3d or rendering tasks, the cross operator is frequently used to get normal vector of a panel. For example, the CVPR 2020 best paper unsup3d, and ECCV 2020 best paper are both about 3d and rendering. So I'm glad to see the support of cross operator. This will benefit the convert from the research to application.

@stale
Copy link

stale bot commented Mar 28, 2022

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale label Mar 28, 2022
@saeed1262
Copy link

Any chance this will be added to the supported ops?

@stale stale bot removed the stale label Apr 19, 2022
@ivan-alles
Copy link

I need this too, to computing elements of a rotation matrix.

@justinchuby
Copy link
Contributor

microsoft/onnxscript#512

justinchuby added a commit to microsoft/onnxscript that referenced this issue Mar 10, 2023
@Francis235
Copy link

I need this op too, is this operator supported now?

@andife
Copy link
Member

andife commented Jan 31, 2024

Being added to onnxscript means that the export should work for Pytorch?
But not a separate operator but a combination of other operators?

@andife andife reopened this Jan 31, 2024
@justinchuby
Copy link
Contributor

Being added to onnxscript means that the export should work for Pytorch? But not a separate operator but a combination of other operators?

That is correct. I am not aware of a strong motivation to standardize this operator in the ONNX spec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Request for new feature or operator operator Issues related to ONNX operators
Projects
None yet
Development

No branches or pull requests

9 participants