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

[feat] Add support for argmax and argmin #1312

Merged
merged 3 commits into from
Sep 2, 2022

Conversation

mfeliz-cruise
Copy link
Contributor

Adds support for aten::argmax and aten::argmin.

Fixes # (issue)

Please delete options that are not relevant and/or add your own.

  • Bug fix (non-breaking change which fixes an issue)

  • New feature (non-breaking change which adds functionality)

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

  • This change requires a documentation update

  • My code follows the style guidelines of this project (You can use the linters)

  • I have performed a self-review of my own code

  • I have commented my code, particularly in hard-to-understand areas and hacks

  • I have made corresponding changes to the documentation

  • I have added tests to verify my fix or my feature

  • New and existing unit tests pass locally with my changes

  • I have added the relevant labels to my PR in so that relevant reviewers are notified

Adds support for aten::argmax and aten::argmin.

Fixes # (issue)

Please delete options that are not relevant and/or add your own.

- Bug fix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)
- Breaking change (fix or feature that would cause existing functionality to not work as expected)
- This change requires a documentation update

- [ ] My code follows the style guidelines of this project (You can use the linters)
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas and hacks
- [ ] I have made corresponding changes to the documentation
- [ ] I have added tests to verify my fix or my feature
- [ ] New and existing unit tests pass locally with my changes
- [ ] I have added the relevant labels to my PR in so that relevant reviewers are notified
@github-actions github-actions bot added component: conversion Issues re: Conversion stage component: converters Issues re: Specific op converters component: core Issues re: The core compiler component: tests Issues re: Tests labels Aug 25, 2022
Copy link
Collaborator

@narendasan narendasan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes seem fine but some style stuff, why are the converters in max.cpp but the tests in topk.cpp? Also seems like the linter needs to be run on the test code.

@mfeliz-cruise
Copy link
Contributor Author

Changes seem fine but some style stuff, why are the converters in max.cpp but the tests in topk.cpp? Also seems like the linter needs to be run on the test code.

ATenMaxDimConvertsCorrectly was already in the topk tests so I followed that pattern for the rest of the file.

@mfeliz-cruise
Copy link
Contributor Author

Changes seem fine but some style stuff, why are the converters in max.cpp but the tests in topk.cpp? Also seems like the linter needs to be run on the test code.

In my environment clang-format tests/core/conversion/converters/test_topk.cpp -i is not making any changes. Is there a good way to see what the github linter is complaining about?

@narendasan
Copy link
Collaborator

Changes seem fine but some style stuff, why are the converters in max.cpp but the tests in topk.cpp? Also seems like the linter needs to be run on the test code.

In my environment clang-format tests/core/conversion/converters/test_topk.cpp -i is not making any changes. Is there a good way to see what the github linter is complaining about?

pre-commit run --all-files runs the same linters we run in CI

@narendasan
Copy link
Collaborator

Changes seem fine but some style stuff, why are the converters in max.cpp but the tests in topk.cpp? Also seems like the linter needs to be run on the test code.

ATenMaxDimConvertsCorrectly was already in the topk tests so I followed that pattern for the rest of the file.

Hmm, can you just move all the min/max tests into test_max.cpp? Not sure why it was put in topk but thats probably confusing.

@mfeliz-cruise
Copy link
Contributor Author

Changes seem fine but some style stuff, why are the converters in max.cpp but the tests in topk.cpp? Also seems like the linter needs to be run on the test code.

ATenMaxDimConvertsCorrectly was already in the topk tests so I followed that pattern for the rest of the file.

Hmm, can you just move all the min/max tests into test_max.cpp? Not sure why it was put in topk but thats probably confusing.

I've moved the tests to a new file, test_max.cpp. I'm still seeing a lint failure here, but I'm not seeing any issues running pre-commit locally.

pre-commit run --files core/conversion/converters/impl/max.cpp
Check Yaml...........................................(no files to check)Skipped
Trim Trailing Whitespace.................................................Passed
Check for added large files..............................................Passed
Check vcs permalinks.....................................................Passed
Check for merge conflicts................................................Passed
Mixed line ending........................................................Passed
black................................................(no files to check)Skipped
clang-format.............................................................Passed
buildifier...........................................(no files to check)Skipped
buildifier-lint......................................(no files to check)Skipped
NVIDIA-INTERNAL check....................................................Passed

pre-commit run --files tests/core/conversion/converters/BUILD
Check Yaml...........................................(no files to check)Skipped
Trim Trailing Whitespace.................................................Passed
Check for added large files..............................................Passed
Check vcs permalinks.....................................................Passed
Check for merge conflicts................................................Passed
Mixed line ending........................................................Passed
black................................................(no files to check)Skipped
clang-format.........................................(no files to check)Skipped
buildifier...............................................................Passed
buildifier-lint..........................................................Passed
NVIDIA-INTERNAL check....................................................Passed

pre-commit run --files tests/core/conversion/converters/test_max.cpp
Check Yaml...........................................(no files to check)Skipped
Trim Trailing Whitespace.................................................Passed
Check for added large files..............................................Passed
Check vcs permalinks.....................................................Passed
Check for merge conflicts................................................Passed
Mixed line ending........................................................Passed
black................................................(no files to check)Skipped
clang-format.............................................................Passed
buildifier...........................................(no files to check)Skipped
buildifier-lint......................................(no files to check)Skipped
NVIDIA-INTERNAL check....................................................Passed

pre-commit run --files tests/core/conversion/converters/test_topk.cpp
Check Yaml...........................................(no files to check)Skipped
Trim Trailing Whitespace.................................................Passed
Check for added large files..............................................Passed
Check vcs permalinks.....................................................Passed
Check for merge conflicts................................................Passed
Mixed line ending........................................................Passed
black................................................(no files to check)Skipped
clang-format.............................................................Passed
buildifier...........................................(no files to check)Skipped
buildifier-lint......................................(no files to check)Skipped
NVIDIA-INTERNAL check....................................................Passed

@narendasan
Copy link
Collaborator

narendasan commented Sep 1, 2022

Seems like the issue is file permissions:

diff --git a/home/runner/work/TensorRT/TensorRT/core/conversion/converters/impl/max.cpp b/tmp/changes.txt
old mode 100755
new mode 100644
ERROR: Some files do not conform to style guidelines

Something like this should work

chmod 0644 core/conversion/converters/impl/max.cpp

Copy link
Collaborator

@narendasan narendasan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, LGTM!

@narendasan narendasan merged commit 9db2852 into pytorch:master Sep 2, 2022
narendasan added a commit that referenced this pull request Sep 9, 2022
* chore: additional options for perf_run tool

Signed-off-by: dperi <dperi@nvidia.com>

* feat: Add fx2trt backend and revamp current perf utility to accept CLI arguments

Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.com>

* chore: Refactor fx2trt functionality

Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.com>

* chore: Fix fp16 functionality for fx2trt backend

Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.com>

* chore: refactor

Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.com>

* chore: minor change

Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.com>

* refactor: Refactor perf_run and add internal benchmark scripts

Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.com>

* chore : minor refactor

Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.com>

* chore: Apply precommit tooling

Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.com>

* chore: Fix data loader issues and nox file paths

Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.com>

* chore: rebase and minor changes

Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.com>

* chore: Fix reporting to a file setting

Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.com>

* Update lower.py (#1324)

* docs: [Automated] Regenerating documenation for e374eb1

Signed-off-by: Torch-TensorRT Github Bot <torch-tensorrt.github.bot@nvidia.com>

* refactor: Refactor testing to use cosine similarity, remove redundancy models and restructuring

Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.com>

* chore: move to cosine similarity comparison

Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.com>

* refactor: Refactor nox file testing

Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.com>

* chore: add missing scripts

Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.com>

* chore: Linter fixes

Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.com>

* fix!: Fixed Windows compilation failures

Signed-off-by: Anurag Dixit <a.dixit91@gmail.com>

* chore: Minor fix

Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.com>

* chore: use rn18 instead of rn50

Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.com>

* docs: [Automated] Regenerating documenation for a1a4786

Signed-off-by: Torch-TensorRT Github Bot <torch-tensorrt.github.bot@nvidia.com>

* chore: Add cpp tests with cosine sim

Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.com>

* chore: linter fixes

Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.com>

* [feat] Add support for argmax and argmin (#1312)

* [feat] Add support for argmax and argmin

Adds support for aten::argmax and aten::argmin.

Fixes # (issue)

Please delete options that are not relevant and/or add your own.

- Bug fix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)
- Breaking change (fix or feature that would cause existing functionality to not work as expected)
- This change requires a documentation update

- [ ] My code follows the style guidelines of this project (You can use the linters)
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas and hacks
- [ ] I have made corresponding changes to the documentation
- [ ] I have added tests to verify my fix or my feature
- [ ] New and existing unit tests pass locally with my changes
- [ ] I have added the relevant labels to my PR in so that relevant reviewers are notified

* move max.cpp tests to test_max.cpp no functional change

* fix permissions on max.cpp

* docs: [Automated] Regenerating documenation for 9db2852

Signed-off-by: Torch-TensorRT Github Bot <torch-tensorrt.github.bot@nvidia.com>

* chore: Deepcopy other objects

Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.com>

* fix: Fix deepcopy issues of PTQ calibrators

Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.com>

* chore: linter fixes

Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.com>

* chore: Adding a guideline to build on Windows platform (#1337)

* chore: Adding Windows build guideline

Signed-off-by: Anurag Dixit <a.dixit91@gmail.com>

* chore: Fix formatting

Signed-off-by: Anurag Dixit <a.dixit91@gmail.com>

Signed-off-by: Anurag Dixit <a.dixit91@gmail.com>

* docs: [Automated] Regenerating documenation for 00a1f03

Signed-off-by: Torch-TensorRT Github Bot <torch-tensorrt.github.bot@nvidia.com>

* chore: minor fixes

Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.com>

* chore: Linter fixes

Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.com>

* chore: Linter fixes

Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.com>

* docs: [Automated] Regenerating documenation for 1efe4b1

Signed-off-by: Torch-TensorRT Github Bot <torch-tensorrt.github.bot@nvidia.com>

* docs: [Automated] Regenerating documenation for 10b9ecd

Signed-off-by: Torch-TensorRT Github Bot <torch-tensorrt.github.bot@nvidia.com>

* add support for aten::reciprocal(int) (#1308)

* docs: [Automated] Regenerating documenation for 096fd41

Signed-off-by: Torch-TensorRT Github Bot <torch-tensorrt.github.bot@nvidia.com>

Signed-off-by: dperi <dperi@nvidia.com>
Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.com>
Signed-off-by: Torch-TensorRT Github Bot <torch-tensorrt.github.bot@nvidia.com>
Signed-off-by: Anurag Dixit <a.dixit91@gmail.com>
Co-authored-by: dperi <dperi@nvidia.com>
Co-authored-by: Dheeraj Peri <peri.dheeraj@gmail.com>
Co-authored-by: Wei <wwei6@fb.com>
Co-authored-by: Torch-TensorRT Github Bot <torch-tensorrt.github.bot@nvidia.com>
Co-authored-by: Anurag Dixit <a.dixit91@gmail.com>
Co-authored-by: Michael Feliz <104801882+mfeliz-cruise@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla signed component: conversion Issues re: Conversion stage component: converters Issues re: Specific op converters component: core Issues re: The core compiler component: tests Issues re: Tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants