Skip to content

Added Converters for Basic Casting Operations#607

Open
JWLee89 wants to merge 10 commits into
NVIDIA-AI-IOT:masterfrom
JWLee89:cast-converter
Open

Added Converters for Basic Casting Operations#607
JWLee89 wants to merge 10 commits into
NVIDIA-AI-IOT:masterfrom
JWLee89:cast-converter

Conversation

@JWLee89

@JWLee89 JWLee89 commented Aug 11, 2021

Copy link
Copy Markdown

Added support for the following casting operations under the converters/cast.py.

  • .float(). e.g x.float()
  • .int(). e.g x.int()
  • .bool(). e.g x.bool()

Tests are included along with the converters (see attached image below).

Note: .long() is not included as this is a 64 bit data type and TensorRT does not support 64 bit data types.

Test Outputs

NUM_TESTS: 330
NUM_SUCCESSFUL_CONVERSION: 329
NUM_FAILED_CONVERSION: 1
NUM_ABOVE_TOLERANCE: 4
NUM_pSNR_TOLERANCE: 11

Verified that the one NUM_FAILED_CONVERSION is unrelated to the added code by commenting out from .cast import * in __init__.py and re-running tests.

Test environment

PyTorch version: 1.8.0+cu111
Cuda: 11.1
TensorRT Version: 7.2.2.1
GPU: GeForce RTX 3090
Ubuntu version: Ubuntu 18.04.5 LTS

cast_test

@JWLee89 JWLee89 changed the title Added TensorRT Converters for Basic Casting Operations Added Converters for Basic Casting Operations Aug 12, 2021
Comment thread torch2trt/converters/cast.py
@JWLee89

JWLee89 commented May 18, 2022

Copy link
Copy Markdown
Author

Hi @jaybdub,

I was wondering if there are any possible potential issues with this PR?
If so, do you have any suggestions on how to improve the feature?

P.S. Apologies for the ping. I know that you are busy.

Thank you very much for taking time out of your schedule to take a look at this.

Best regards,
Jay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants