-
Notifications
You must be signed in to change notification settings - Fork 932
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
Uses torch.einsum
for quat_rotate and quat_rotate_inverse operations
#900
Conversation
…now can operate multidimensional tensors and not longer limited to 2D inputs of shape (B,4) or (B, 3)
Hi there, I have done the testing for this but not too sure where to add the test scripts to in the repo so I left it out. Please let me know if I need to add the tests and if my changes have issues. Thanks :) |
Thanks a lot for looking at this! Based on past experience, Here is where we usually put all the tests related to the math module: https://github.com/isaac-sim/IsaacLab/blob/main/source/extensions/omni.isaac.lab/test/utils/test_math.py |
I implemented the test in test_math.py and everything seems ok. I also timed the two implementations. The following table shows the time (in s) it took to operate on ~10 000 quat and vec, averaged over 100 tests.
0.001194 / 0.000426 = 2.8 |
Hi @dxyy1 Thank you for writing the test. I checked it locally and it works fine :) I made some modifications to it to make sure the numbers are correct. The I made those changes in the test below: Based on above, I get the following timings for quaternion of shape (1024, 2, 5, 4)
Could you take the modified test to your branch (I can't seem to be able to push there). Also would be great to fill up the rest of the checklist in the MR description. |
torch.einsum
for quat_rotate and quat_rotate_inverse operations
Interesting. I tried with single-batched dimension, i.e., the quaternion shape of (4096, 4). There is a small drop in performance with the new implementation. It isn't majorly concerning, but it is something to consider. @kellyguo11 @jsmith-bdai thoughts?
|
Thank you for writing the test case, @Mayankm96 . I think your test case is honestly much neater than mine, and kinda made me realize there is much for me to learn in coding in that regard. So thank you :). My understanding is that |
Hi there! Given that
I ran the tests again and got the following results Test A is the results of the latest implementation in the comit timed on my machine. CPU
CUDA
Preivously, @Mayankm96 noted that the Do you think implementing this |
Signed-off-by: Mayank Mittal <12863862+Mayankm96@users.noreply.github.com>
Signed-off-by: Mayank Mittal <12863862+Mayankm96@users.noreply.github.com>
Yes that makes sense. 5 microsecond isn't a lot but would be good to keep the speed up. It isn't that messy to have this small if-else. Shouldn't be that messy. Can you please add that, update the |
…-commit formatter prior to this commit
I made the changes. I am not too sure if I modified the extension.toml and changelog correctly so please check them :). I also ran the pre-commit formatter. |
Signed-off-by: Mayank Mittal <12863862+Mayankm96@users.noreply.github.com>
…irements and modules
Signed-off-by: dxyy1 <139338590+dxyy1@users.noreply.github.com>
Hi there, Please let me know if I missed anything else! Thank you :) |
Signed-off-by: Mayank Mittal <12863862+Mayankm96@users.noreply.github.com>
Signed-off-by: Mayank Mittal <12863862+Mayankm96@users.noreply.github.com>
Signed-off-by: Mayank Mittal <12863862+Mayankm96@users.noreply.github.com>
Signed-off-by: Mayank Mittal <12863862+Mayankm96@users.noreply.github.com>
Signed-off-by: Mayank Mittal <12863862+Mayankm96@users.noreply.github.com>
@jsmith-bdai @Dhoeller19 Can we also get your approval so that we can merge this MR? |
isaac-sim#900) # Description Extended the two functions' capability so they now can take in multidimensional tensors and no longer limited to 2D tensors of shape (B,4) and (B, 3) ## Type of change - New feature (non-breaking change which adds functionality) ## Checklist - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have updated the changelog and the corresponding version in the extension's `config/extension.toml` file - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there --------- Signed-off-by: Mayank Mittal <12863862+Mayankm96@users.noreply.github.com> Signed-off-by: dxyy1 <139338590+dxyy1@users.noreply.github.com> Co-authored-by: Mayank Mittal <12863862+Mayankm96@users.noreply.github.com>
Description
Extended the two functions' capability so they now can take in multidimensional tensors and no longer limited to 2D tensors of shape (B,4) and (B, 3)
Type of change
Screenshots
Checklist
pre-commit
checks with./isaaclab.sh --format
config/extension.toml
fileCONTRIBUTORS.md
or my name already exists there