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 integers in aten::abs converter (#35) #1232

Merged
merged 3 commits into from
Aug 7, 2022

Conversation

mfeliz-cruise
Copy link
Contributor

@mfeliz-cruise mfeliz-cruise commented Aug 4, 2022

Adds support for aten::abs with integer input. Previous implementation relied on the UnaryLayer kABS implementation which does not support integers.

https://docs.nvidia.com/deeplearning/tensorrt/api/c_api/classnvinfer1_1_1_i_network_definition.html#a77831224c9a72ad02587a56ded93c672

Generally the input must have a floating-point type (or kINT8 as a quantized float), except for the following operations:

kSIGN accepts a floating-point or Int32 tensor.
kNOT requires a Bool tensor.

Fixes # (#1231)

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

Signed-off-by: Michael Feliz michael.feliz@getcruise.com

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Type of change

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

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

Checklist:

  • 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::abs with integer input. Previous implementation relied on the UnaryLayer kABS implementation which does not support integers.

https://docs.nvidia.com/deeplearning/tensorrt/api/c_api/classnvinfer1_1_1_i_network_definition.html#a77831224c9a72ad02587a56ded93c672
```
Generally the input must have a floating-point type (or kINT8 as a quantized float), except for the following operations:

kSIGN accepts a floating-point or Int32 tensor.
kNOT requires a Bool tensor.
```

Fixes # (pytorch#1231)

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

Signed-off-by: Michael Feliz <michael.feliz@getcruise.com>
@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 4, 2022
@@ -1,13 +1,55 @@
#include "core/conversion/converters/converters.h"
#include "core/util/prelude.h"

#include <torch/torch.h>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Small thing we use quotations instead of angle brackets for non stdlib includes (bazel convention from a while back)

@@ -1,4 +1,5 @@
#include <string>
#include <torch/torch.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you change this to use quotes instead of anchor braces?
It seems the lint is failing. Can you try applying lint on the PR?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't worry about the lint we are going to do a sweep of the repo before release, seems like some non conformant code got merged and its been messing up the action for a but

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I've fixed the include. In general is there a working development docker that is set up to run torch-tensorrt and the linter? The cudnn and tensorrt dependencies in docker/Dockerfile do not seem to install correctly.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We are overhauling the linting system to run as a pre-commit hook after just before this release goes out. The tools should be installable on host through pip #1223

Copy link
Collaborator

@narendasan narendasan Aug 5, 2022

Choose a reason for hiding this comment

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

I use the Dockerfile.docs container for development in container since it most aligns with our internal host environment. The other Dockerfile is mostly for users using already released NGC TRT versions

@peri044 peri044 merged commit d0e471f into pytorch:master Aug 7, 2022
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

5 participants