-
Notifications
You must be signed in to change notification settings - Fork 357
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
support adaptive_max_pooling, fix adpative_avg_pooling bug #328
Conversation
Signed-off-by: inocsin <vcheungyi@163.com>
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.
There are some changes that do not conform to C++ style guidelines:
diff --git a/workspace/core/conversion/converters/impl/plugins/adaptive_max_pool2d_plugin.cpp b/tmp/changes.txt
index 84a2e1f..597c30e 100644
--- a/workspace/core/conversion/converters/impl/plugins/adaptive_max_pool2d_plugin.cpp
+++ b/tmp/changes.txt
@@ -194,10 +194,8 @@ int AdaptiveMaxPool2dPlugin::enqueue(
cudaStream_t stream) {
#if NV_TENSORRT_MAJOR < 7 || (NV_TENSORRT_MAJOR == 7 && NV_TENSORRT_MINOR < 1)
at::Tensor input = at::from_blob((void*)inputs[0], util::toVec(inputDesc->dims), [](void*) {}, tensor_options_);
- at::Tensor output = at::from_blob(
- outputs[0], util::volume(outputDesc->dims), [](void*) {}, tensor_options_);
- at::Tensor indices = at::from_blob(
- outputs[1], util::volume(outputDesc->dims), [](void*) {}, index_tensor_options_);
+ at::Tensor output = at::from_blob(outputs[0], util::volume(outputDesc->dims), [](void*) {}, tensor_options_);
+ at::Tensor indices = at::from_blob(outputs[1], util::volume(outputDesc->dims), [](void*) {}, index_tensor_options_);
at::cuda::CUDAStream torch_stream = at::cuda::getStreamFromPool();
at::cuda::CUDAStreamGuard torch_guard(torch_stream);
diff --git a/workspace/core/conversion/converters/impl/plugins/interpolate_plugin.cpp b/tmp/changes.txt
index ff9ba86..5689d88 100644
--- a/workspace/core/conversion/converters/impl/plugins/interpolate_plugin.cpp
+++ b/tmp/changes.txt
@@ -254,8 +254,7 @@ int InterpolatePlugin::enqueue(
cudaStream_t stream) {
#if NV_TENSORRT_MAJOR < 7 || (NV_TENSORRT_MAJOR == 7 && NV_TENSORRT_MINOR < 1)
at::Tensor input = at::from_blob((void*)inputs[0], util::toVec(inputDesc->dims), [](void*) {}, tensor_options_);
- at::Tensor output = at::from_blob(
- outputs[0], util::volume(outputDesc->dims), [](void*) {}, tensor_options_);
+ at::Tensor output = at::from_blob(outputs[0], util::volume(outputDesc->dims), [](void*) {}, tensor_options_);
at::cuda::CUDAStream torch_stream = at::cuda::getStreamFromPool();
at::cuda::CUDAStreamGuard torch_guard(torch_stream);
ERROR: Some files do not conform to style guidelines
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.
Code conforms to Python style guidelines
Can you apply the linting? |
Signed-off-by: inocsin <vcheungyi@163.com>
applied linting |
The tests are running fine. It looks like the existing Interpolate plugin already calls |
The output number, datatype and parameter number of adaptive_max_pool are different from interpolate_plugin, in that case should we use several if-else to merge these two plugin into one? |
…n cannot use gpu to accelerate Signed-off-by: inocsin <vcheungyi@163.com>
Signed-off-by: inocsin <vcheungyi@163.com>
@narendasan @peri044 please review the update, I have fixed some bugs of original interpolate plugin |
Thanks @inocsin Merged these changes into the new plugins interface. Tried to cherry pick your commits but there are lot of changes in the new API which were limiting it. |
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.
Type of change
Fix aten::adaptive_avg_pool2d bug when input size is not integer multiple of output size, update the test case
Support aten::adaptive_max_pool2d with test case
-Bug fix
Remove "#if NV_TENSORRT_MAJOR < 7 || (NV_TENSORRT_MAJOR == 7 && NV_TENSORRT_MINOR < 1)" part.
Since the TensorRT dependency is updated, the original GPU part will never be used, all the operator will be forced to run on cpu. So I remove the TensorRT flag. But the GPU part failed with unknow reason after the flag was removed, so I refactored the gpu part, now it can run on GPU correctly.
Checklist: