-
Notifications
You must be signed in to change notification settings - Fork 367
fix: Use user provided dtype when we can't infer it from the graph #962
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
Changes from all commits
14650d1
aed82a0
aa3f57a
b677e8d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,13 @@ bool valid_dtype_format_combo(nvinfer1::DataType dtype, nvinfer1::TensorFormat f | |
default: | ||
return false; | ||
} | ||
case nvinfer1::DataType::kBOOL: // Supports Linear (NCHW) | ||
switch (format) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We probably should be more clear to the user why a BOOL / NHWC combo doesnt work There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NHWC is only bound to FP32 according to https://docs.nvidia.com/deeplearning/tensorrt/api/c_api/namespacenvinfer1.html#ac3e115b1a2b1e578e8221ef99d27cd45 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I understand, I mean we need to throw a descriptive error or something There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably put this at the API level |
||
case nvinfer1::TensorFormat::kLINEAR: | ||
return true; | ||
default: | ||
return false; | ||
} | ||
default: | ||
return false; | ||
} | ||
|
@@ -48,7 +55,7 @@ bool valid_dtype_format_combo(nvinfer1::DataType dtype, nvinfer1::TensorFormat f | |
bool valid_input_dtype(nvinfer1::DataType dtype) { | ||
switch (dtype) { | ||
case nvinfer1::DataType::kBOOL: | ||
return false; | ||
return true; | ||
case nvinfer1::DataType::kFLOAT: | ||
return true; | ||
case nvinfer1::DataType::kHALF: | ||
|
@@ -153,4 +160,4 @@ std::ostream& operator<<(std::ostream& os, const Input& input) { | |
|
||
} // namespace ir | ||
} // namespace core | ||
} // namespace torch_tensorrt | ||
} // namespace torch_tensorrt |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -240,7 +240,6 @@ def run(self): | |
include_dirs=[ | ||
dir_path + "torch_tensorrt/csrc", dir_path + "torch_tensorrt/include", | ||
dir_path + "/../bazel-TRTorch/external/tensorrt/include", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might as well keep this since if people dont redownload the repo after the namechange its going to break the build There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added it back. But it would be nice to clean this up at some point in time. |
||
dir_path + "/../bazel-Torch-TensorRT-Preview/external/tensorrt/include", | ||
dir_path + "/../bazel-Torch-TensorRT/external/tensorrt/include", dir_path + "/../" | ||
], | ||
extra_compile_args=[ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how does this work with this patch? #902
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your patch works in the case where the estimated type is not same as the user provided type. In this case, you override with user provided dtype.
In this PR. if the user dtype is defined (dtype_is_user_defined=True) and if the est_type_opt is null (which happens for the bitwise OR graph I linked in the PR where inferred type is empty, I use user provided types.