-
Notifications
You must be signed in to change notification settings - Fork 352
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(core/plugins): Plugins redesign #425
Conversation
Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
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 Python style guidelines:
Reformatting /workspace/cpp/ptq/training/vgg16/export_ckpt.py
Reformatting /workspace/cpp/ptq/training/vgg16/vgg16.py
Reformatting /workspace/cpp/ptq/training/vgg16/main.py
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/tests/core/conversion/converters/test_batch_norm.cpp b/tmp/changes.txt
index fdbf0a9..11767c1 100644
--- a/workspace/tests/core/conversion/converters/test_batch_norm.cpp
+++ b/tmp/changes.txt
@@ -73,7 +73,7 @@ TEST(Converters, ATenBatchNormShouldUnpackConvertsCorrectly) {
}
TEST(Converters, ATenInstanceNormWithConvertsCorrectly) {
-const auto graph = R"IR(
+ const auto graph = R"IR(
graph(%0 : Tensor,
%1: Float(5, strides=[1]),
%2: Float(5, strides=[1]),
diff --git a/workspace/core/lowering/register_trt_placeholder_ops.cpp b/tmp/changes.txt
index b15ce5c..bafb2c3 100644
--- a/workspace/core/lowering/register_trt_placeholder_ops.cpp
+++ b/tmp/changes.txt
@@ -10,7 +10,10 @@ c10::AliasAnalysisKind aliasAnalysisFromSchema() {
RegisterOperators trt_placeholder_ops_reg({
/// Op marks a Tensor to be conveted from an Torch Tensor
/// to a TRT constant Tensor
- Operator("trt::const(Tensor val) -> Tensor", [](Stack* stack) {}, aliasAnalysisFromSchema()),
+ Operator(
+ "trt::const(Tensor val) -> Tensor",
+ [](Stack* stack) {},
+ aliasAnalysisFromSchema()),
});
} // namespace jit
diff --git a/workspace/core/conversion/conversionctx/ConversionCtx.cpp b/tmp/changes.txt
index 8a4bc9b..7bae724 100644
--- a/workspace/core/conversion/conversionctx/ConversionCtx.cpp
+++ b/tmp/changes.txt
@@ -48,7 +48,6 @@ ConversionCtx::ConversionCtx(BuilderSettings build_settings)
"[TRTorch Conversion Context] - ",
util::logging::get_logger().get_reportable_severity(),
util::logging::get_logger().get_is_colored_output_on()) {
-
// TODO: Support FP16 and FP32 from JIT information
if (settings.device.gpu_id) {
TRTORCH_CHECK(
diff --git a/workspace/core/conversion/converters/impl/pooling.cpp b/tmp/changes.txt
index bea9e48..a08185b 100644
--- a/workspace/core/conversion/converters/impl/pooling.cpp
+++ b/tmp/changes.txt
@@ -320,21 +320,25 @@ auto pooling_registrations TRTORCH_UNUSED =
std::vector<nvinfer1::PluginField> f;
std::vector<int32_t> in_shape_casted(in_shape.begin(), in_shape.end());
- f.emplace_back(nvinfer1::PluginField("in_shape", in_shape_casted.data(), nvinfer1::PluginFieldType::kINT32, in_shape.size()));
+ f.emplace_back(nvinfer1::PluginField(
+ "in_shape", in_shape_casted.data(), nvinfer1::PluginFieldType::kINT32, in_shape.size()));
std::vector<int32_t> out_shape_casted(out_shape.begin(), out_shape.end());
- f.emplace_back(nvinfer1::PluginField("out_shape", out_shape_casted.data(), nvinfer1::PluginFieldType::kINT32, out_shape.size()));
+ f.emplace_back(nvinfer1::PluginField(
+ "out_shape", out_shape_casted.data(), nvinfer1::PluginFieldType::kINT32, out_shape.size()));
std::vector<int32_t> out_size_casted(out_size.begin(), out_size.end());
- f.emplace_back(nvinfer1::PluginField("out_size", out_size_casted.data(), nvinfer1::PluginFieldType::kINT32, out_size.size()));
+ f.emplace_back(nvinfer1::PluginField(
+ "out_size", out_size_casted.data(), nvinfer1::PluginFieldType::kINT32, out_size.size()));
f.emplace_back(nvinfer1::PluginField("scales", nullptr, nvinfer1::PluginFieldType::kFLOAT64, 0));
std::string name = "adaptive_pool2d";
- f.emplace_back(nvinfer1::PluginField("mode", &name, nvinfer1::PluginFieldType::kCHAR , 1));
+ f.emplace_back(nvinfer1::PluginField("mode", &name, nvinfer1::PluginFieldType::kCHAR, 1));
int32_t align_corners = 0;
- f.emplace_back(nvinfer1::PluginField("align_corners", &align_corners, nvinfer1::PluginFieldType::kINT32, 1));
+ f.emplace_back(
+ nvinfer1::PluginField("align_corners", &align_corners, nvinfer1::PluginFieldType::kINT32, 1));
int32_t use_scales = 0;
f.emplace_back(nvinfer1::PluginField("use_scales", &use_scales, nvinfer1::PluginFieldType::kINT32, 1));
diff --git a/workspace/core/conversion/var/Var.cpp b/tmp/changes.txt
index 71b77f5..8356934 100644
--- a/workspace/core/conversion/var/Var.cpp
+++ b/tmp/changes.txt
@@ -89,7 +89,7 @@ nvinfer1::ITensor* Var::ITensorOrFreeze(ConversionCtx* ctx) {
if (isIValue()) {
LOG_DEBUG(ctx->logger, "Found IValue containing object of type " << *(ptr_.ivalue->type()));
}
-
+
TRTORCH_CHECK(
isITensor() || (isIValue() && (ptr_.ivalue->isTensor() || ptr_.ivalue->isCustomClass())),
"Requested either IValue containing a Tensor, or ITensor, however Var type is " << type_name());
@@ -100,8 +100,10 @@ nvinfer1::ITensor* Var::ITensorOrFreeze(ConversionCtx* ctx) {
if (ptr_.ivalue->isTensor()) {
auto weights = converters::Weights();
auto tensor = ptr_.ivalue->toTensor();
- if ((tensor.scalar_type() == at::kLong || tensor.scalar_type() == at::kDouble) && !ctx->settings.truncate_long_and_double) {
- TRTORCH_THROW_ERROR("Unable to freeze tensor of type Int64/Float64 into constant layer, try to compile model with truncate_long_and_double enabled");
+ if ((tensor.scalar_type() == at::kLong || tensor.scalar_type() == at::kDouble) &&
+ !ctx->settings.truncate_long_and_double) {
+ TRTORCH_THROW_ERROR(
+ "Unable to freeze tensor of type Int64/Float64 into constant layer, try to compile model with truncate_long_and_double enabled");
} else if (tensor.scalar_type() == at::kLong && ctx->settings.truncate_long_and_double) {
weights = converters::Weights(ctx, tensor.toType(at::kInt));
LOG_WARNING("Truncating weight (constant in the graph) from Int64 to Int32");
@@ -111,7 +113,7 @@ nvinfer1::ITensor* Var::ITensorOrFreeze(ConversionCtx* ctx) {
} else {
weights = converters::Weights(ctx, tensor);
}
-
+
auto const_layer = ctx->net->addConstant(weights.shape, weights.data);
TRTORCH_CHECK(const_layer, "Unable to freeze tensor into constant layer");
out = const_layer->getOutput(0);
diff --git a/workspace/core/plugins/register_plugins.cpp b/tmp/changes.txt
index 6c7a43a..7186a6a 100644
--- a/workspace/core/plugins/register_plugins.cpp
+++ b/tmp/changes.txt
@@ -1,17 +1,18 @@
-#include "core/util/prelude.h"
-#include "core/plugins/plugins.h"
#include "NvInferPlugin.h"
#include "NvInferPluginUtils.h"
+#include "core/plugins/plugins.h"
+#include "core/util/prelude.h"
-namespace trtorch{
-namespace core{
-namespace plugins{
+namespace trtorch {
+namespace core {
+namespace plugins {
class TRTorchPluginRegistry {
public:
- TRTorchPluginRegistry(){
+ TRTorchPluginRegistry() {
// initialize initLibNvInferPlugins
- auto trtorch_logger = util::logging::TRTorchLogger("[TRTorch Plugins Context] - ",
+ auto trtorch_logger = util::logging::TRTorchLogger(
+ "[TRTorch Plugins Context] - ",
util::logging::get_logger().get_reportable_severity(),
util::logging::get_logger().get_is_colored_output_on());
initLibNvInferPlugins(&trtorch_logger, "");
@@ -22,6 +23,6 @@ namespace {
static TRTorchPluginRegistry plugin_registry;
}
-}
-}
-}
+} // namespace plugins
+} // namespace core
+} // namespace trtorch
diff --git a/workspace/core/plugins/impl/interpolate_plugin.cpp b/tmp/changes.txt
index 71cf9e5..44896fb 100644
--- a/workspace/core/plugins/impl/interpolate_plugin.cpp
+++ b/tmp/changes.txt
@@ -253,7 +253,8 @@ 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);
diff --git a/workspace/core/plugins/impl/normalize_plugin.cpp b/tmp/changes.txt
index ba675f9..90246f9 100644
--- a/workspace/core/plugins/impl/normalize_plugin.cpp
+++ b/tmp/changes.txt
@@ -187,7 +187,8 @@ int NormalizePlugin::enqueue(
// TRT <= 7.0
#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);
diff --git a/workspace/core/plugins/plugins.h b/tmp/changes.txt
index c24f188..c285187 100644
--- a/workspace/core/plugins/plugins.h
+++ b/tmp/changes.txt
@@ -4,26 +4,26 @@
#include "NvInferPluginUtils.h"
#include "core/util/prelude.h"
-namespace trtorch{
-namespace core{
-namespace plugins{
+namespace trtorch {
+namespace core {
+namespace plugins {
namespace nvinfer1 {
-//Alternate implementation similar to automatic converter registration.
+// Alternate implementation similar to automatic converter registration.
template <typename T>
-class PluginRegistrar
-{
-public:
- PluginRegistrar() {
- getPluginRegistry()->registerCreator(instance, "");
- }
-private:
- T instance{};
+class PluginRegistrar {
+ public:
+ PluginRegistrar() {
+ getPluginRegistry()->registerCreator(instance, "");
+ }
+
+ private:
+ T instance{};
};
#define REGISTER_TRTORCH_PLUGIN(name) \
- static nvinfer1::PluginRegistrar<name> pluginRegistrar##name {}
+ static nvinfer1::PluginRegistrar<name> pluginRegistrar##name {}
} // namespace nvinfer1
-}
-}
-}
+} // namespace plugins
+} // namespace core
+} // namespace trtorch
ERROR: Some files do not conform to style guidelines
Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Ruoqian Guo <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
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/lowering/register_trt_placeholder_ops.cpp b/tmp/changes.txt
index b15ce5c..bafb2c3 100644
--- a/workspace/core/lowering/register_trt_placeholder_ops.cpp
+++ b/tmp/changes.txt
@@ -10,7 +10,10 @@ c10::AliasAnalysisKind aliasAnalysisFromSchema() {
RegisterOperators trt_placeholder_ops_reg({
/// Op marks a Tensor to be conveted from an Torch Tensor
/// to a TRT constant Tensor
- Operator("trt::const(Tensor val) -> Tensor", [](Stack* stack) {}, aliasAnalysisFromSchema()),
+ Operator(
+ "trt::const(Tensor val) -> Tensor",
+ [](Stack* stack) {},
+ aliasAnalysisFromSchema()),
});
} // namespace jit
diff --git a/workspace/core/conversion/conversionctx/ConversionCtx.cpp b/tmp/changes.txt
index d95a522..3de959f 100644
--- a/workspace/core/conversion/conversionctx/ConversionCtx.cpp
+++ b/tmp/changes.txt
@@ -52,7 +52,6 @@ ConversionCtx::ConversionCtx(BuilderSettings build_settings)
"[TRTorch Conversion Context] - ",
util::logging::get_logger().get_reportable_severity(),
util::logging::get_logger().get_is_colored_output_on()) {
-
// TODO: Support FP16 and FP32 from JIT information
if (settings.device.gpu_id) {
TRTORCH_CHECK(
diff --git a/workspace/core/plugins/impl/interpolate_plugin.cpp b/tmp/changes.txt
index 71cf9e5..44896fb 100644
--- a/workspace/core/plugins/impl/interpolate_plugin.cpp
+++ b/tmp/changes.txt
@@ -253,7 +253,8 @@ 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);
diff --git a/workspace/core/plugins/impl/normalize_plugin.cpp b/tmp/changes.txt
index ba675f9..90246f9 100644
--- a/workspace/core/plugins/impl/normalize_plugin.cpp
+++ b/tmp/changes.txt
@@ -187,7 +187,8 @@ int NormalizePlugin::enqueue(
// TRT <= 7.0
#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.
There are some changes that do not conform to Python style guidelines:
Reformatting /workspace/cpp/ptq/training/vgg16/export_ckpt.py
Reformatting /workspace/cpp/ptq/training/vgg16/vgg16.py
Reformatting /workspace/cpp/ptq/training/vgg16/main.py
Signed-off-by: Dheeraj Peri <[email protected]>
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 Python style guidelines:
Reformatting /workspace/cpp/ptq/training/vgg16/export_ckpt.py
Reformatting /workspace/cpp/ptq/training/vgg16/vgg16.py
Reformatting /workspace/cpp/ptq/training/vgg16/main.py
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/lowering/register_trt_placeholder_ops.cpp b/tmp/changes.txt
index b15ce5c..bafb2c3 100644
--- a/workspace/core/lowering/register_trt_placeholder_ops.cpp
+++ b/tmp/changes.txt
@@ -10,7 +10,10 @@ c10::AliasAnalysisKind aliasAnalysisFromSchema() {
RegisterOperators trt_placeholder_ops_reg({
/// Op marks a Tensor to be conveted from an Torch Tensor
/// to a TRT constant Tensor
- Operator("trt::const(Tensor val) -> Tensor", [](Stack* stack) {}, aliasAnalysisFromSchema()),
+ Operator(
+ "trt::const(Tensor val) -> Tensor",
+ [](Stack* stack) {},
+ aliasAnalysisFromSchema()),
});
} // namespace jit
diff --git a/workspace/core/conversion/conversionctx/ConversionCtx.cpp b/tmp/changes.txt
index d95a522..3de959f 100644
--- a/workspace/core/conversion/conversionctx/ConversionCtx.cpp
+++ b/tmp/changes.txt
@@ -52,7 +52,6 @@ ConversionCtx::ConversionCtx(BuilderSettings build_settings)
"[TRTorch Conversion Context] - ",
util::logging::get_logger().get_reportable_severity(),
util::logging::get_logger().get_is_colored_output_on()) {
-
// TODO: Support FP16 and FP32 from JIT information
if (settings.device.gpu_id) {
TRTORCH_CHECK(
diff --git a/workspace/core/plugins/impl/interpolate_plugin.cpp b/tmp/changes.txt
index 71cf9e5..44896fb 100644
--- a/workspace/core/plugins/impl/interpolate_plugin.cpp
+++ b/tmp/changes.txt
@@ -253,7 +253,8 @@ 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);
diff --git a/workspace/core/plugins/impl/normalize_plugin.cpp b/tmp/changes.txt
index ba675f9..90246f9 100644
--- a/workspace/core/plugins/impl/normalize_plugin.cpp
+++ b/tmp/changes.txt
@@ -187,7 +187,8 @@ int NormalizePlugin::enqueue(
// TRT <= 7.0
#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
Signed-off-by: Dheeraj Peri <[email protected]>
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 Python style guidelines:
Reformatting /workspace/cpp/ptq/training/vgg16/export_ckpt.py
Reformatting /workspace/cpp/ptq/training/vgg16/vgg16.py
Reformatting /workspace/cpp/ptq/training/vgg16/main.py
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/lowering/register_trt_placeholder_ops.cpp b/tmp/changes.txt
index b15ce5c..bafb2c3 100644
--- a/workspace/core/lowering/register_trt_placeholder_ops.cpp
+++ b/tmp/changes.txt
@@ -10,7 +10,10 @@ c10::AliasAnalysisKind aliasAnalysisFromSchema() {
RegisterOperators trt_placeholder_ops_reg({
/// Op marks a Tensor to be conveted from an Torch Tensor
/// to a TRT constant Tensor
- Operator("trt::const(Tensor val) -> Tensor", [](Stack* stack) {}, aliasAnalysisFromSchema()),
+ Operator(
+ "trt::const(Tensor val) -> Tensor",
+ [](Stack* stack) {},
+ aliasAnalysisFromSchema()),
});
} // namespace jit
diff --git a/workspace/core/plugins/impl/interpolate_plugin.cpp b/tmp/changes.txt
index bce23ca..5374ec3 100644
--- a/workspace/core/plugins/impl/interpolate_plugin.cpp
+++ b/tmp/changes.txt
@@ -252,7 +252,8 @@ 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);
diff --git a/workspace/core/plugins/impl/normalize_plugin.cpp b/tmp/changes.txt
index 062f3b4..57eb60f 100644
--- a/workspace/core/plugins/impl/normalize_plugin.cpp
+++ b/tmp/changes.txt
@@ -184,7 +184,8 @@ int NormalizePlugin::enqueue(
// TRT <= 7.0
#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.
There are some changes that do not conform to C++ style guidelines:
diff --git a/workspace/core/plugins/impl/normalize_plugin.cpp b/tmp/changes.txt
index 3e5b764..876cf15 100644
--- a/workspace/core/plugins/impl/normalize_plugin.cpp
+++ b/tmp/changes.txt
@@ -185,7 +185,7 @@ int NormalizePlugin::enqueue(
#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_);
+ 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
Signed-off-by: Dheeraj Peri <[email protected]>
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
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 C++ style guidelines
@narendasan Fixed the linting issues. |
@peri044 can you rebase and fix any conflicts by EOD tomorrow? |
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
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 C++ style guidelines
@narendasan done. Good to merge now |
Signed-off-by: Dheeraj Peri <[email protected]>
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 C++ 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
@narendasan Rebased it. |
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 C++ 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
Signed-off-by: Dheeraj Peri <[email protected]>
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
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/pooling.cpp b/tmp/changes.txt
index d20c3ab..61da608 100644
--- a/workspace/core/conversion/converters/impl/pooling.cpp
+++ b/tmp/changes.txt
@@ -84,13 +84,13 @@ bool AdaptivePoolingConverter(
nvinfer1::PluginField("in_shape", in_shape_casted.data(), nvinfer1::PluginFieldType::kINT32, in_shape.size()));
std::vector<int32_t> out_shape_casted(out_shape.begin(), out_shape.end());
- f.emplace_back(
- nvinfer1::PluginField("out_shape", out_shape_casted.data(), nvinfer1::PluginFieldType::kINT32, out_shape.size()));
+ f.emplace_back(nvinfer1::PluginField(
+ "out_shape", out_shape_casted.data(), nvinfer1::PluginFieldType::kINT32, out_shape.size()));
auto out_size_vec = util::toVec(out_size);
std::vector<int32_t> out_size_casted(out_size_vec.begin(), out_size_vec.end());
- f.emplace_back(
- nvinfer1::PluginField("out_size", out_size_casted.data(), nvinfer1::PluginFieldType::kINT32, out_size_vec.size()));
+ f.emplace_back(nvinfer1::PluginField(
+ "out_size", out_size_casted.data(), nvinfer1::PluginFieldType::kINT32, out_size_vec.size()));
f.emplace_back(nvinfer1::PluginField("scales", nullptr, nvinfer1::PluginFieldType::kFLOAT64, 0));
diff --git a/workspace/core/plugins/impl/normalize_plugin.cpp b/tmp/changes.txt
index 4b261f5..307f3bb 100644
--- a/workspace/core/plugins/impl/normalize_plugin.cpp
+++ b/tmp/changes.txt
@@ -72,8 +72,8 @@ nvinfer1::DimsExprs NormalizePlugin::getOutputDimensions(
// For order-0 norm, when the norm dimension is None, it should normalize across all dimensions.
// TODO: For dim=None, the axes_ passed would have [0, 0, 0] which is obtained through loop counter in TRTorch.
// Resolve this. For dim=None case, change the axes_ inplace to range(0, axes_.size())
- bool isAxisNone =
- std::all_of(axes_.begin(), axes_.end(), [](int32_t i) { return i == 0; }) && ((int32_t) axes_.size() == inputs[0].nbDims);
+ bool isAxisNone = std::all_of(axes_.begin(), axes_.end(), [](int32_t i) { return i == 0; }) &&
+ ((int32_t)axes_.size() == inputs[0].nbDims);
if (isAxisNone) {
std::iota(axes_.data(), axes_.data() + axes_.size(), 0);
}
ERROR: Some files do not conform to style guidelines
Signed-off-by: Dheeraj Peri <[email protected]>
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
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/pooling.cpp b/tmp/changes.txt
index 49f4c97..61da608 100644
--- a/workspace/core/conversion/converters/impl/pooling.cpp
+++ b/tmp/changes.txt
@@ -80,8 +80,8 @@ bool AdaptivePoolingConverter(
std::copy_n(out_size.d, out_size.nbDims, out_shape.begin() + (in_shape.size() - out_size.nbDims));
std::vector<int32_t> in_shape_casted(in_shape.begin(), in_shape.end());
- f.emplace_back(nvinfer1::PluginField(
- "in_shape", in_shape_casted.data(), nvinfer1::PluginFieldType::kINT32, in_shape.size()));
+ f.emplace_back(
+ nvinfer1::PluginField("in_shape", in_shape_casted.data(), nvinfer1::PluginFieldType::kINT32, in_shape.size()));
std::vector<int32_t> out_shape_casted(out_shape.begin(), out_shape.end());
f.emplace_back(nvinfer1::PluginField(
diff --git a/workspace/core/plugins/impl/normalize_plugin.cpp b/tmp/changes.txt
index 7818d89..307f3bb 100644
--- a/workspace/core/plugins/impl/normalize_plugin.cpp
+++ b/tmp/changes.txt
@@ -73,7 +73,7 @@ nvinfer1::DimsExprs NormalizePlugin::getOutputDimensions(
// TODO: For dim=None, the axes_ passed would have [0, 0, 0] which is obtained through loop counter in TRTorch.
// Resolve this. For dim=None case, change the axes_ inplace to range(0, axes_.size())
bool isAxisNone = std::all_of(axes_.begin(), axes_.end(), [](int32_t i) { return i == 0; }) &&
- ((int32_t) axes_.size() == inputs[0].nbDims);
+ ((int32_t)axes_.size() == inputs[0].nbDims);
if (isAxisNone) {
std::iota(axes_.data(), axes_.data() + axes_.size(), 0);
}
ERROR: Some files do not conform to style guidelines
Signed-off-by: Dheeraj Peri <[email protected]>
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
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 C++ 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.
LGTM
Description
Redesigning plugin API according to #385
Changes all plugins mentioned in #385
Type of change
Please delete options that are not relevant and/or add your own.
Checklist: