-
Notifications
You must be signed in to change notification settings - Fork 359
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
chore: minor fixes #1397
chore: minor fixes #1397
Conversation
Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.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.
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 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
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 <peri.dheeraj@gmail.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/home/runner/work/TensorRT/TensorRT/tests/util/util.cpp b/tmp/changes.txt
index c51ed5b..39d1eb1 100644
--- a/home/runner/work/TensorRT/TensorRT/tests/util/util.cpp
+++ b/tmp/changes.txt
@@ -32,7 +32,7 @@ bool cosineSimEqual(const at::Tensor& computed_tensor, const at::Tensor& gt_tens
std::ostringstream ss;
ss << computed_tensor << std::endl << gt_tensor << std::endl;
LOG_DEBUG(ss.str());
- if (computed_tensor.sum().item<float>() == 0.f || gt_tensor.sum().item<float>() == 0.f){
+ if (computed_tensor.sum().item<float>() == 0.f || gt_tensor.sum().item<float>() == 0.f) {
return almostEqual(computed_tensor, gt_tensor);
} else {
LOG_DEBUG(std::string("Cosine Similarity score: ") + std::to_string(cosine_sim.item<float>()));
diff --git a/home/runner/work/TensorRT/TensorRT/tests/cpp/test_compiled_modules.cpp b/tmp/changes.txt
index 5d8eace..d982c8e 100644
--- a/home/runner/work/TensorRT/TensorRT/tests/cpp/test_compiled_modules.cpp
+++ b/tmp/changes.txt
@@ -41,8 +41,7 @@ TEST_P(CppAPITests, CompiledModuleIsClose) {
}
for (size_t i = 0; i < trt_results.size(); i++) {
- ASSERT_TRUE(
- torch_tensorrt::tests::util::cosineSimEqual(jit_results[i], trt_results[i].reshape_as(jit_results[i])));
+ ASSERT_TRUE(torch_tensorrt::tests::util::cosineSimEqual(jit_results[i], trt_results[i].reshape_as(jit_results[i])));
}
}
diff --git a/home/runner/work/TensorRT/TensorRT/tests/cpp/test_default_input_types.cpp b/tmp/changes.txt
index 46908b8..dd32001 100644
--- a/home/runner/work/TensorRT/TensorRT/tests/cpp/test_default_input_types.cpp
+++ b/tmp/changes.txt
@@ -116,5 +116,4 @@ TEST_P(CppAPITests, InputsRespectUserSettingFP32WeightsFP16In) {
INSTANTIATE_TEST_SUITE_P(
CompiledModuleForwardIsCloseSuite,
CppAPITests,
- testing::Values(
- PathAndInput({"tests/modules/resnet18_traced.jit.pt", {{1, 3, 224, 224}}, {at::kFloat}})));
+ testing::Values(PathAndInput({"tests/modules/resnet18_traced.jit.pt", {{1, 3, 224, 224}}, {at::kFloat}})));
diff --git a/home/runner/work/TensorRT/TensorRT/tests/cpp/test_multiple_registered_engines.cpp b/tmp/changes.txt
index ae986b6..23029bb 100644
--- a/home/runner/work/TensorRT/TensorRT/tests/cpp/test_multiple_registered_engines.cpp
+++ b/tmp/changes.txt
@@ -56,13 +56,13 @@ TEST(CppAPITest, CanRunMultipleEngines) {
trt2_results.push_back(trt2_results_ivalues.toTensor());
for (size_t i = 0; i < trt1_results.size(); i++) {
- ASSERT_TRUE(torch_tensorrt::tests::util::cosineSimEqual(
- jit1_results[i], trt1_results[i].reshape_as(jit1_results[i])));
+ ASSERT_TRUE(
+ torch_tensorrt::tests::util::cosineSimEqual(jit1_results[i], trt1_results[i].reshape_as(jit1_results[i])));
}
for (size_t i = 0; i < trt2_results.size(); i++) {
- ASSERT_TRUE(torch_tensorrt::tests::util::cosineSimEqual(
- jit2_results[i], trt2_results[i].reshape_as(jit2_results[i])));
+ ASSERT_TRUE(
+ torch_tensorrt::tests::util::cosineSimEqual(jit2_results[i], trt2_results[i].reshape_as(jit2_results[i])));
}
}
#endif
diff --git a/home/runner/work/TensorRT/TensorRT/tests/cpp/test_modules_as_engines.cpp b/tmp/changes.txt
index f68bac9..b76bae7 100644
--- a/home/runner/work/TensorRT/TensorRT/tests/cpp/test_modules_as_engines.cpp
+++ b/tmp/changes.txt
@@ -14,8 +14,7 @@ TEST_P(CppAPITests, ModuleAsEngineIsClose) {
jit_results.push_back(jit_results_ivalues.toTensor());
auto trt_results = torch_tensorrt::tests::util::RunModuleForwardAsEngine(mod, inputs);
- ASSERT_TRUE(torch_tensorrt::tests::util::cosineSimEqual(
- jit_results[0], trt_results[0].reshape_as(jit_results[0])));
+ ASSERT_TRUE(torch_tensorrt::tests::util::cosineSimEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0])));
}
#ifndef DISABLE_TEST_IN_CI
diff --git a/home/runner/work/TensorRT/TensorRT/tests/cpp/test_collections.cpp b/tmp/changes.txt
index 248d4da..7fcc006 100644
--- a/home/runner/work/TensorRT/TensorRT/tests/cpp/test_collections.cpp
+++ b/tmp/changes.txt
@@ -188,8 +188,10 @@ TEST(CppAPITests, TestCollectionTupleInputOutput) {
auto trt_mod = torch_tensorrt::torchscript::compile(mod, compile_settings);
auto trt_out = trt_mod.forward(complex_inputs);
- ASSERT_TRUE(torch_tensorrt::tests::util::cosineSimEqual(out.toTuple()->elements()[0].toTensor(), trt_out.toTuple()->elements()[0].toTensor()));
- ASSERT_TRUE(torch_tensorrt::tests::util::cosineSimEqual(out.toTuple()->elements()[1].toTensor(), trt_out.toTuple()->elements()[1].toTensor()));
+ ASSERT_TRUE(torch_tensorrt::tests::util::cosineSimEqual(
+ out.toTuple()->elements()[0].toTensor(), trt_out.toTuple()->elements()[0].toTensor()));
+ ASSERT_TRUE(torch_tensorrt::tests::util::cosineSimEqual(
+ out.toTuple()->elements()[1].toTensor(), trt_out.toTuple()->elements()[1].toTensor()));
}
TEST(CppAPITests, TestCollectionListInputOutput) {
@@ -247,8 +249,10 @@ TEST(CppAPITests, TestCollectionListInputOutput) {
auto trt_mod = torch_tensorrt::torchscript::compile(mod, compile_settings);
auto trt_out = trt_mod.forward(complex_inputs);
- ASSERT_TRUE(torch_tensorrt::tests::util::cosineSimEqual(out.toList().vec()[0].toTensor(), trt_out.toList().vec()[0].toTensor()));
- ASSERT_TRUE(torch_tensorrt::tests::util::cosineSimEqual(out.toList().vec()[1].toTensor(), trt_out.toList().vec()[1].toTensor()));
+ ASSERT_TRUE(torch_tensorrt::tests::util::cosineSimEqual(
+ out.toList().vec()[0].toTensor(), trt_out.toList().vec()[0].toTensor()));
+ ASSERT_TRUE(torch_tensorrt::tests::util::cosineSimEqual(
+ out.toList().vec()[1].toTensor(), trt_out.toList().vec()[1].toTensor()));
}
TEST(CppAPITests, TestCollectionComplexModel) {
@@ -306,6 +310,8 @@ TEST(CppAPITests, TestCollectionComplexModel) {
auto trt_mod = torch_tensorrt::torchscript::compile(mod, compile_settings);
auto trt_out = trt_mod.forward(complex_inputs);
- ASSERT_TRUE(torch_tensorrt::tests::util::cosineSimEqual(out.toTuple()->elements()[0].toTensor(), trt_out.toTuple()->elements()[0].toTensor()));
- ASSERT_TRUE(torch_tensorrt::tests::util::cosineSimEqual(out.toTuple()->elements()[1].toTensor(), trt_out.toTuple()->elements()[1].toTensor()));
+ ASSERT_TRUE(torch_tensorrt::tests::util::cosineSimEqual(
+ out.toTuple()->elements()[0].toTensor(), trt_out.toTuple()->elements()[0].toTensor()));
+ ASSERT_TRUE(torch_tensorrt::tests::util::cosineSimEqual(
+ out.toTuple()->elements()[1].toTensor(), trt_out.toTuple()->elements()[1].toTensor()));
}
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
@narendasan
|
Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.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.
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
Signed-off-by: Dheeraj Peri peri.dheeraj@gmail.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.
Checklist: