diff --git a/tests/core/conversion/converters/test_activation.cpp b/tests/core/conversion/converters/test_activation.cpp index d1baa75083..dceab208c2 100644 --- a/tests/core/conversion/converters/test_activation.cpp +++ b/tests/core/conversion/converters/test_activation.cpp @@ -22,7 +22,7 @@ TEST(Converters, ATenReLUConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenSigmoidConvertsCorrectly) { @@ -42,7 +42,7 @@ TEST(Converters, ATenSigmoidConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 5e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenTanhConvertsCorrectly) { @@ -62,7 +62,7 @@ TEST(Converters, ATenTanhConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 7e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } // TODO: Seems like the IR parser is not handling negative numbers well, need to @@ -86,7 +86,7 @@ TEST(Converters, ATenHardTanhConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenHardTanhCustomRangeConvertsCorrectly) { @@ -108,7 +108,7 @@ TEST(Converters, ATenHardTanhCustomRangeConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenPReLUConvertsCorrectly) { @@ -131,7 +131,7 @@ TEST(Converters, ATenPReLUConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {slope}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenPReLUChannelAlignConvertsCorrectly) { @@ -178,7 +178,7 @@ TEST(Converters, ATenPReLUChannelAlignConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenPReLUMultiChannelConvertsCorrectly) { @@ -201,7 +201,7 @@ TEST(Converters, ATenPReLUMultiChannelConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {slope}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenLeakyReluConvertsCorrectly) { @@ -222,7 +222,7 @@ TEST(Converters, ATenLeakyReluConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenEluConvertsCorrectly) { @@ -245,7 +245,7 @@ TEST(Converters, ATenEluConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } #ifndef DISABLE_TEST_IN_CI diff --git a/tests/core/conversion/converters/test_atan2.cpp b/tests/core/conversion/converters/test_atan2.cpp index d899dff759..fac46cd2bf 100644 --- a/tests/core/conversion/converters/test_atan2.cpp +++ b/tests/core/conversion/converters/test_atan2.cpp @@ -25,8 +25,7 @@ TEST(Converters, ATenAtan2ConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in_0, in_1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenAtan2ManagesPosInfCorrectly) { @@ -48,8 +47,7 @@ TEST(Converters, ATenAtan2ManagesPosInfCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in_0, in_1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenAtan2ManagesNegInfCorrectly) { @@ -71,6 +69,5 @@ TEST(Converters, ATenAtan2ManagesNegInfCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in_0, in_1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } \ No newline at end of file diff --git a/tests/core/conversion/converters/test_batch_norm.cpp b/tests/core/conversion/converters/test_batch_norm.cpp index fd3712030d..807a1ec39b 100644 --- a/tests/core/conversion/converters/test_batch_norm.cpp +++ b/tests/core/conversion/converters/test_batch_norm.cpp @@ -32,8 +32,7 @@ TEST(Converters, ATenBatchNormConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {gamma, beta, mean, var}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenBatchNormAffineFalseConvertsCorrectly) { @@ -63,8 +62,7 @@ TEST(Converters, ATenBatchNormAffineFalseConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {mean, var}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenBatchNorm1DConvertsCorrectly) { @@ -96,8 +94,7 @@ TEST(Converters, ATenBatchNorm1DConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {gamma, beta, mean, var}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenBatchNormShouldUnpackConvertsCorrectly) { @@ -134,8 +131,7 @@ TEST(Converters, ATenBatchNormShouldUnpackConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {trt_gamma, trt_beta, trt_mean, trt_var}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenBatchNormHalfConvertsCorrectly) { diff --git a/tests/core/conversion/converters/test_cast.cpp b/tests/core/conversion/converters/test_cast.cpp index 601eefa2bf..b4ba05efaf 100644 --- a/tests/core/conversion/converters/test_cast.cpp +++ b/tests/core/conversion/converters/test_cast.cpp @@ -34,7 +34,7 @@ TEST(Converters, ATenBoolToFP32DTypeConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); ASSERT_TRUE(jit_results[0].scalar_type() == trt.scalar_type()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenBoolToINT32DTypeConvertsCorrectly) { @@ -65,7 +65,7 @@ TEST(Converters, ATenBoolToINT32DTypeConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); ASSERT_TRUE(jit_results[0].scalar_type() == trt.scalar_type()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenBoolToINT32DeviceDTypeConvertsCorrectly) { @@ -97,7 +97,7 @@ TEST(Converters, ATenBoolToINT32DeviceDTypeConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); ASSERT_TRUE(jit_results[0].scalar_type() == trt.scalar_type()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenBoolToINT32TensorConvertsCorrectly) { @@ -132,7 +132,7 @@ TEST(Converters, ATenBoolToINT32TensorConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); ASSERT_TRUE(jit_results[0].scalar_type() == trt.scalar_type()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenToSingleConvertsCorrectly) { @@ -160,7 +160,7 @@ TEST(Converters, ATenToSingleConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); ASSERT_TRUE(jit_results[0].scalar_type() == trt.scalar_type()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenToDuplicateConvertsCorrectly) { @@ -187,7 +187,7 @@ TEST(Converters, ATenToDuplicateConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); for (size_t i = 0UL; i < jit_results.size(); ++i) { ASSERT_TRUE(jit_results[i].scalar_type() == trt_results[i].scalar_type()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt_results[i], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt_results[i])); } } @@ -218,6 +218,5 @@ TEST(Converters, ATenTypeAsConvertsCorrectly) { ASSERT_TRUE(jit_results[0].scalar_type() == trt_results[0].scalar_type()); ASSERT_TRUE(trt_results[0].scalar_type() == trt_results[1].scalar_type()); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } diff --git a/tests/core/conversion/converters/test_chunk.cpp b/tests/core/conversion/converters/test_chunk.cpp index eccefbea99..e22edbe13e 100644 --- a/tests/core/conversion/converters/test_chunk.cpp +++ b/tests/core/conversion/converters/test_chunk.cpp @@ -30,5 +30,5 @@ TEST(Converters, ATenChunkConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } \ No newline at end of file diff --git a/tests/core/conversion/converters/test_clone.cpp b/tests/core/conversion/converters/test_clone.cpp index 2e0fba14e7..b18d2cee8d 100644 --- a/tests/core/conversion/converters/test_clone.cpp +++ b/tests/core/conversion/converters/test_clone.cpp @@ -26,6 +26,5 @@ TEST(Converters, ATenCloneConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } diff --git a/tests/core/conversion/converters/test_concat.cpp b/tests/core/conversion/converters/test_concat.cpp index a311df1c7a..a3ff9c0c84 100644 --- a/tests/core/conversion/converters/test_concat.cpp +++ b/tests/core/conversion/converters/test_concat.cpp @@ -25,8 +25,7 @@ TEST(Converters, ATenCatPureTensorConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1, in2}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenCatFloatIntConvertsCorrectly) { @@ -50,7 +49,7 @@ TEST(Converters, ATenCatFloatIntConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1, in2}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenCatIntHalfIntHalfConvertsCorrectly) { @@ -79,7 +78,7 @@ TEST(Converters, ATenCatIntHalfIntHalfConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1, in2, in3, in4}, nvinfer1::DataType::kHALF); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenCatHalfIntFloatConvertsCorrectly) { @@ -105,7 +104,7 @@ TEST(Converters, ATenCatHalfIntFloatConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1, in2, in3}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenCatDiffTensorConvertsCorrectly) { @@ -129,8 +128,7 @@ TEST(Converters, ATenCatDiffTensorConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {in2}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenCatPureTensorNegDimConvertsCorrectly) { const auto graph = R"IR( @@ -153,8 +151,7 @@ TEST(Converters, ATenCatPureTensorNegDimConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1, in2}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenCatDiffTensorNegDimConvertsCorrectly) { @@ -178,6 +175,5 @@ TEST(Converters, ATenCatDiffTensorNegDimConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {in2}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } diff --git a/tests/core/conversion/converters/test_constant_pad.cpp b/tests/core/conversion/converters/test_constant_pad.cpp index c5f0bd8a31..fd93c0c8f2 100644 --- a/tests/core/conversion/converters/test_constant_pad.cpp +++ b/tests/core/conversion/converters/test_constant_pad.cpp @@ -24,8 +24,7 @@ TEST(Converters, ATenConstantPad1dTensorConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenConstantPad1dIntTensorConvertsCorrectly) { @@ -47,8 +46,7 @@ TEST(Converters, ATenConstantPad1dIntTensorConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenConstantPad1dRightZeroTensorConvertsCorrectly) { @@ -70,8 +68,7 @@ TEST(Converters, ATenConstantPad1dRightZeroTensorConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenConstantPad1dTensorConvertsCorrectlyWithDynamic) { @@ -93,8 +90,7 @@ TEST(Converters, ATenConstantPad1dTensorConvertsCorrectlyWithDynamic) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngineDynamic(g, params, {in1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenConstantPad2dTensorConvertsCorrectly) { @@ -116,8 +112,7 @@ TEST(Converters, ATenConstantPad2dTensorConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenConstantPad2dRightBottomZeroTensorConvertsCorrectly) { @@ -139,8 +134,7 @@ TEST(Converters, ATenConstantPad2dRightBottomZeroTensorConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenConstantPad2dTensorConvertsCorrectlyWithDynamic) { @@ -162,8 +156,7 @@ TEST(Converters, ATenConstantPad2dTensorConvertsCorrectlyWithDynamic) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngineDynamic(g, params, {in1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenConstantPad3dTensorConvertsCorrectly) { @@ -185,8 +178,7 @@ TEST(Converters, ATenConstantPad3dTensorConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenConstantPad3dRightBottomBackZeroTensorConvertsCorrectly) { @@ -207,8 +199,7 @@ TEST(Converters, ATenConstantPad3dRightBottomBackZeroTensorConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenConstantPad3dTensorConvertsCorrectlyWithDynamic) { @@ -230,6 +221,5 @@ TEST(Converters, ATenConstantPad3dTensorConvertsCorrectlyWithDynamic) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngineDynamic(g, params, {in1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } diff --git a/tests/core/conversion/converters/test_conv_deconv.cpp b/tests/core/conversion/converters/test_conv_deconv.cpp index 662da71a6f..61b6906852 100644 --- a/tests/core/conversion/converters/test_conv_deconv.cpp +++ b/tests/core/conversion/converters/test_conv_deconv.cpp @@ -33,7 +33,7 @@ void conv_test_helper(std::string graph_ir) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenConvolutionConvertsCorrectly) { @@ -75,7 +75,7 @@ TEST(Converters, ATenConvolutionConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenConvolution1dConvertsCorrectly) { @@ -113,7 +113,7 @@ TEST(Converters, ATenConvolution1dConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenConv1dWithWeightTensorsConvertsCorrectly) { @@ -164,7 +164,7 @@ TEST(Converters, ATenConv1dWithWeightTensorsConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {trt_w}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}, nvinfer1::DataType::kINT8); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenConvolutionNoBiasConvertsCorrectly) { @@ -202,7 +202,7 @@ TEST(Converters, ATenConvolutionNoBiasConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenConvolutionWithStrideConvertsCorrectly) { @@ -245,7 +245,7 @@ TEST(Converters, ATenConvolutionWithStrideConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenConvolutionWithPaddingConvertsCorrectly) { @@ -288,7 +288,7 @@ TEST(Converters, ATenConvolutionWithPaddingConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenConvolution3dConvertsCorrectly) { @@ -330,7 +330,7 @@ TEST(Converters, ATenConvolution3dConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenConvolution3dNoBiasConvertsCorrectly) { @@ -368,7 +368,7 @@ TEST(Converters, ATenConvolution3dNoBiasConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenConvolution3dWithPaddingConvertsCorrectly) { @@ -410,7 +410,7 @@ TEST(Converters, ATenConvolution3dWithPaddingConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenConvolution3dWithStrideDilationConvertsCorrectly) { @@ -452,7 +452,7 @@ TEST(Converters, ATenConvolution3dWithStrideDilationConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenConvTransposeConvertsCorrectly) { @@ -494,7 +494,7 @@ TEST(Converters, ATenConvTransposeConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenConvTranspose2dWithWeightsAsTensorsConvertsCorrectly) { @@ -547,7 +547,7 @@ TEST(Converters, ATenConvTranspose2dWithWeightsAsTensorsConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in, trt_w}, nvinfer1::DataType::kINT8); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenConvTransposeNoBiasConvertsCorrectly) { @@ -585,7 +585,7 @@ TEST(Converters, ATenConvTransposeNoBiasConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenConvTransposeWithStrideConvertsCorrectly) { @@ -628,7 +628,7 @@ TEST(Converters, ATenConvTransposeWithStrideConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenConvTransposeWithPaddingConvertsCorrectly) { @@ -671,7 +671,7 @@ TEST(Converters, ATenConvTransposeWithPaddingConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenConv1dTransposeWithPaddingOutPaddingConvertsCorrectly) { @@ -710,7 +710,7 @@ TEST(Converters, ATenConv1dTransposeWithPaddingOutPaddingConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenConv1dTransposeWithWeightTensorsConvertsCorrectly) { @@ -761,7 +761,7 @@ TEST(Converters, ATenConv1dTransposeWithWeightTensorsConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {trt_w}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}, nvinfer1::DataType::kINT8); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenConvTransposeWithPaddingOutPaddingConvertsCorrectly) { @@ -804,7 +804,7 @@ TEST(Converters, ATenConvTransposeWithPaddingOutPaddingConvertsCorrectly) { auto trt = trt_results[0]; - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenConvTransposeOutPaddingBiggerThanPaddingConvertsCorrectly) { @@ -847,7 +847,7 @@ TEST(Converters, ATenConvTransposeOutPaddingBiggerThanPaddingConvertsCorrectly) auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenConvolutionWithGroupConvertsCorrectly) { @@ -890,7 +890,7 @@ TEST(Converters, ATenConvolutionWithGroupConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenConvTransposeWithGroupConvertsCorrectly) { @@ -933,5 +933,5 @@ TEST(Converters, ATenConvTransposeWithGroupConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } diff --git a/tests/core/conversion/converters/test_copy.cpp b/tests/core/conversion/converters/test_copy.cpp index 8213c8f2dc..6847d73b59 100644 --- a/tests/core/conversion/converters/test_copy.cpp +++ b/tests/core/conversion/converters/test_copy.cpp @@ -34,6 +34,5 @@ TEST(Converters, ATenCopyConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } diff --git a/tests/core/conversion/converters/test_cumsum.cpp b/tests/core/conversion/converters/test_cumsum.cpp index df9142941c..f972ebef7e 100644 --- a/tests/core/conversion/converters/test_cumsum.cpp +++ b/tests/core/conversion/converters/test_cumsum.cpp @@ -23,7 +23,7 @@ TEST(Converters, ATenCumsumConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenCumsumConvertsCorrectlyWithDynamicInput) { @@ -45,7 +45,7 @@ TEST(Converters, ATenCumsumConvertsCorrectlyWithDynamicInput) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngineDynamic(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenCumsumNegativeDimConvertsCorrectly) { @@ -67,7 +67,7 @@ TEST(Converters, ATenCumsumNegativeDimConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenCumsumNegativeDimConvertsCorrectlyWithDynamicInput) { @@ -89,5 +89,5 @@ TEST(Converters, ATenCumsumNegativeDimConvertsCorrectlyWithDynamicInput) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngineDynamic(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } diff --git a/tests/core/conversion/converters/test_div.cpp b/tests/core/conversion/converters/test_div.cpp index 0b879c1829..6c444836a0 100644 --- a/tests/core/conversion/converters/test_div.cpp +++ b/tests/core/conversion/converters/test_div.cpp @@ -180,5 +180,5 @@ TEST(Converters, ATenRemainderWithScalarConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } \ No newline at end of file diff --git a/tests/core/conversion/converters/test_einsum.cpp b/tests/core/conversion/converters/test_einsum.cpp index d45dea54fb..abc03d8b67 100644 --- a/tests/core/conversion/converters/test_einsum.cpp +++ b/tests/core/conversion/converters/test_einsum.cpp @@ -26,8 +26,7 @@ TEST(Converters, ATenEinsumConvertsMatMulCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in_0, in_1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenEinsumConvertsElementwiseProdCorrectly) { @@ -52,8 +51,7 @@ TEST(Converters, ATenEinsumConvertsElementwiseProdCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in_0, in_1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenEinsumConvertsTransposeCorrectly) { @@ -77,8 +75,7 @@ TEST(Converters, ATenEinsumConvertsTransposeCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in_0}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenEinsumConvertsVectorsCorrectly) { @@ -103,6 +100,5 @@ TEST(Converters, ATenEinsumConvertsVectorsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in_0, in_1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } diff --git a/tests/core/conversion/converters/test_expand.cpp b/tests/core/conversion/converters/test_expand.cpp index 341fe29aa4..5056c6cb02 100644 --- a/tests/core/conversion/converters/test_expand.cpp +++ b/tests/core/conversion/converters/test_expand.cpp @@ -30,7 +30,7 @@ TEST(Converters, ATenExpandSameDimConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenExpandSameDimConvertsCorrectlyWithDynamicInput) { @@ -57,7 +57,7 @@ TEST(Converters, ATenExpandSameDimConvertsCorrectlyWithDynamicInput) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenExpandTileConvertsCorrectly) { @@ -84,7 +84,7 @@ TEST(Converters, ATenExpandTileConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenExpandTileConvertsCorrectlyWithDynamicInput) { @@ -111,7 +111,7 @@ TEST(Converters, ATenExpandTileConvertsCorrectlyWithDynamicInput) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenExpandTileLastConvertsCorrectly) { @@ -138,7 +138,7 @@ TEST(Converters, ATenExpandTileLastConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenExpandTileLastConvertsCorrectlyWithDynamicInput) { @@ -165,7 +165,7 @@ TEST(Converters, ATenExpandTileLastConvertsCorrectlyWithDynamicInput) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenExpandNegativeSizeConvertsCorrectly) { @@ -192,7 +192,7 @@ TEST(Converters, ATenExpandNegativeSizeConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenExpandNegativeSizeConvertsCorrectlyWithDynamicInput) { @@ -219,7 +219,7 @@ TEST(Converters, ATenExpandNegativeSizeConvertsCorrectlyWithDynamicInput) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } /* Expand_as layer takes two inputs and only dimensions of second input are @@ -256,7 +256,7 @@ TEST(Converters, ATenExpandASConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenExpandAsConvertsCorrectlyWithDynamicInput) { @@ -288,7 +288,7 @@ TEST(Converters, ATenExpandAsConvertsCorrectlyWithDynamicInput) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenRepeatConvertsCorrectly) { @@ -314,7 +314,7 @@ TEST(Converters, ATenRepeatConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenRepeatConvertsCorrectlyWithDynamicInput) { @@ -340,7 +340,7 @@ TEST(Converters, ATenRepeatConvertsCorrectlyWithDynamicInput) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenRepeat3dConvertsCorrectly) { @@ -366,7 +366,7 @@ TEST(Converters, ATenRepeat3dConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenRepeat3dConvertsCorrectlyWithDynamicInput) { @@ -392,7 +392,7 @@ TEST(Converters, ATenRepeat3dConvertsCorrectlyWithDynamicInput) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenRepeatExtraDimsConvertsCorrectly) { @@ -418,7 +418,7 @@ TEST(Converters, ATenRepeatExtraDimsConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenRepeatExtraDimsConvertsCorrectlyWithDynamicInput) { @@ -444,7 +444,7 @@ TEST(Converters, ATenRepeatExtraDimsConvertsCorrectlyWithDynamicInput) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenRepeatInterleaveScalarDimConvertsCorrectly) { @@ -472,7 +472,7 @@ TEST(Converters, ATenRepeatInterleaveScalarDimConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenRepeatInterleaveScalarDimConvertsCorrectlyWithDynamicInput) { @@ -500,7 +500,7 @@ TEST(Converters, ATenRepeatInterleaveScalarDimConvertsCorrectlyWithDynamicInput) auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenRepeatInterleaveScalarNoDimConvertsCorrectly) { @@ -528,7 +528,7 @@ TEST(Converters, ATenRepeatInterleaveScalarNoDimConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenRepeatInterleaveScalarNoDimConvertsCorrectlyWithDynamicInput) { @@ -556,7 +556,7 @@ TEST(Converters, ATenRepeatInterleaveScalarNoDimConvertsCorrectlyWithDynamicInpu auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenRepeatInterleave3dScalarDimConvertsCorrectly) { @@ -584,7 +584,7 @@ TEST(Converters, ATenRepeatInterleave3dScalarDimConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenRepeatInterleave3dScalarDimConvertsCorrectlyWithDynamicInput) { @@ -612,7 +612,7 @@ TEST(Converters, ATenRepeatInterleave3dScalarDimConvertsCorrectlyWithDynamicInpu auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenRepeatInterleave3dScalarNoDimConvertsCorrectly) { @@ -640,7 +640,7 @@ TEST(Converters, ATenRepeatInterleave3dScalarNoDimConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenRepeatInterleave3dScalarNoDimConvertsCorrectlyWithDynamicInput) { @@ -668,7 +668,7 @@ TEST(Converters, ATenRepeatInterleave3dScalarNoDimConvertsCorrectlyWithDynamicIn auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenTileConvertsCorrectly) { @@ -693,7 +693,7 @@ TEST(Converters, ATenTileConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenTileRepeatRankConvertsCorrectly) { @@ -718,7 +718,7 @@ TEST(Converters, ATenTileRepeatRankConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenTileConvertsCorrectlyWithDynamicInput) { @@ -743,7 +743,7 @@ TEST(Converters, ATenTileConvertsCorrectlyWithDynamicInput) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngineDynamic(g, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenTile3dConvertsCorrectly) { @@ -768,7 +768,7 @@ TEST(Converters, ATenTile3dConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenTile3dConvertsCorrectlyWithDynamicInput) { @@ -793,7 +793,7 @@ TEST(Converters, ATenTile3dConvertsCorrectlyWithDynamicInput) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngineDynamic(g, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenMeshGridConvertsCorrectly) { @@ -826,7 +826,7 @@ TEST(Converters, ATenMeshGridConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_x, trt_y, trt_z}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[1], trt_results[1], 2e-6)); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[2], trt_results[2], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[1], trt_results[1])); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[2], trt_results[2])); } diff --git a/tests/core/conversion/converters/test_index.cpp b/tests/core/conversion/converters/test_index.cpp index b405d7a436..bd6b1782db 100644 --- a/tests/core/conversion/converters/test_index.cpp +++ b/tests/core/conversion/converters/test_index.cpp @@ -29,7 +29,7 @@ TEST(Converters, ATenIndexSelectConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenIndexSelectNegativeDimConvertsCorrectly) { @@ -57,7 +57,7 @@ TEST(Converters, ATenIndexSelectNegativeDimConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenIndexTensorOneIndiceConvertsCorrectly) { @@ -82,8 +82,7 @@ TEST(Converters, ATenIndexTensorOneIndiceConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1, in2_trt}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenIndexTensorFullIndicesConvertsCorrectly) { @@ -113,8 +112,7 @@ TEST(Converters, ATenIndexTensorFullIndicesConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1, index0_trt, index1_trt, index2_trt}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenIndexTensorRepeatedFullIndicesConvertsCorrectly) { @@ -145,8 +143,8 @@ TEST(Converters, ATenIndexTensorRepeatedFullIndicesConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1, index0_trt, index1_trt, index2_trt}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[1], trt_results[1], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[1], trt_results[1])); } TEST(Converters, ATenIndexTensorIdx0Idx1NoneConvertsCorrectly) { @@ -175,8 +173,7 @@ TEST(Converters, ATenIndexTensorIdx0Idx1NoneConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1, index0_trt, index1_trt}); LOG_DEBUG(trt_results); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenIndexTensorIdx0NoneIdx1ConvertsCorrectly) { @@ -204,8 +201,7 @@ TEST(Converters, ATenIndexTensorIdx0NoneIdx1ConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1, index0_trt, index1_trt}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenIndexTensorNoneIdx0Idx1ConvertsCorrectly) { @@ -233,8 +229,7 @@ TEST(Converters, ATenIndexTensorNoneIdx0Idx1ConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1, index0_trt, index1_trt}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenIndexTensorIdxsNoneConvertsCorrectly) { @@ -265,7 +260,7 @@ TEST(Converters, ATenIndexTensorIdxsNoneConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1, index0_trt, index1_trt, index2_trt}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenIndexTensorNoneIdx1ConvertsCorrectly) { @@ -291,5 +286,5 @@ TEST(Converters, ATenIndexTensorNoneIdx1ConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1, index0_trt}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } \ No newline at end of file diff --git a/tests/core/conversion/converters/test_instance_norm.cpp b/tests/core/conversion/converters/test_instance_norm.cpp index 336d050fd1..8f9904ef84 100644 --- a/tests/core/conversion/converters/test_instance_norm.cpp +++ b/tests/core/conversion/converters/test_instance_norm.cpp @@ -47,8 +47,7 @@ TEST(Converters, ATenInstanceNormConvertsCorrectly) { g->inputs(), {trt_weight, trt_bias, trt_mean, trt_var, use_input_stats}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenInstanceNormAffineConvertsCorrectly) { @@ -75,8 +74,7 @@ TEST(Converters, ATenInstanceNormAffineConvertsCorrectly) { g->inputs(), {trt_weight, trt_bias, trt_mean, trt_var, use_input_stats}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenInstanceNormRunningStatsConvertsCorrectly) { @@ -101,6 +99,5 @@ TEST(Converters, ATenInstanceNormRunningStatsConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params( g->inputs(), {trt_weight, trt_bias, trt_mean, trt_var, use_input_stats}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } diff --git a/tests/core/conversion/converters/test_interpolate.cpp b/tests/core/conversion/converters/test_interpolate.cpp index c3b92c3be1..8f64676ef7 100644 --- a/tests/core/conversion/converters/test_interpolate.cpp +++ b/tests/core/conversion/converters/test_interpolate.cpp @@ -21,7 +21,7 @@ \ auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); \ auto trt = trt_results[0].reshape(jit_results[0].sizes()); \ - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); \ + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); \ } \ \ TEST(Converters, name##DynamicConvertsCorrectly) { \ @@ -40,7 +40,7 @@ \ auto trt_results = torch_tensorrt::tests::util::RunGraphEngineDynamic(g, params, {trt_in}); \ auto trt = trt_results[0].reshape(jit_results[0].sizes()); \ - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); \ + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); \ } #define ATEN_INTERPOLATE_STATIC_ONLY_TEST(name, graph_src, input_shape) \ @@ -60,7 +60,7 @@ \ auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); \ auto trt = trt_results[0].reshape(jit_results[0].sizes()); \ - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); \ + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); \ } ATEN_INTERPOLATE_TESTS( @@ -406,7 +406,7 @@ TEST(Converters, GridSampleConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_input, trt_grid}); for (size_t i = 0; i < jit_results.size(); i++) { - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt_results[i], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt_results[i])); } } @@ -438,7 +438,7 @@ TEST(Converters, GridSampleOptions1ConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_input, trt_grid}); for (size_t i = 0; i < jit_results.size(); i++) { - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt_results[i], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt_results[i])); } } @@ -470,6 +470,6 @@ TEST(Converters, GridSampleOptions2ConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_input, trt_grid}); for (size_t i = 0; i < jit_results.size(); i++) { - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt_results[i], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt_results[i])); } } \ No newline at end of file diff --git a/tests/core/conversion/converters/test_layer_norm.cpp b/tests/core/conversion/converters/test_layer_norm.cpp index 9ae04aff1d..459c4d7231 100644 --- a/tests/core/conversion/converters/test_layer_norm.cpp +++ b/tests/core/conversion/converters/test_layer_norm.cpp @@ -29,7 +29,7 @@ TEST(Converters, ATenLayerNormConvertsCorrectlyLast3DimsNoGammaBeta) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenLayerNormConvertsCorrectlyLast3Dims) { @@ -59,7 +59,7 @@ TEST(Converters, ATenLayerNormConvertsCorrectlyLast3Dims) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {gamma, beta}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenLayerNormConvertsCorrectlyLast2Dims) { @@ -88,7 +88,7 @@ TEST(Converters, ATenLayerNormConvertsCorrectlyLast2Dims) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {gamma, beta}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenLayerNormConvertsCorrectlyLast1Dims) { @@ -116,7 +116,7 @@ TEST(Converters, ATenLayerNormConvertsCorrectlyLast1Dims) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {gamma, beta}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenLayerNormConvertsCorrectly3dInput1dNormalizedShape) { @@ -143,5 +143,5 @@ TEST(Converters, ATenLayerNormConvertsCorrectly3dInput1dNormalizedShape) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {gamma, beta}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } diff --git a/tests/core/conversion/converters/test_linear.cpp b/tests/core/conversion/converters/test_linear.cpp index 00c6e4da5d..ef5445dc96 100644 --- a/tests/core/conversion/converters/test_linear.cpp +++ b/tests/core/conversion/converters/test_linear.cpp @@ -27,8 +27,7 @@ TEST(Converters, ATenLinearNoBiasConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {w}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenLinearBiasConvertsCorrectly) { @@ -61,6 +60,5 @@ TEST(Converters, ATenLinearBiasConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {trt_w, trt_b}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } diff --git a/tests/core/conversion/converters/test_lstm_cell.cpp b/tests/core/conversion/converters/test_lstm_cell.cpp index b9d7c7b1fc..29152ceb7d 100644 --- a/tests/core/conversion/converters/test_lstm_cell.cpp +++ b/tests/core/conversion/converters/test_lstm_cell.cpp @@ -49,8 +49,7 @@ TEST(Converters, ATenGRUCellConvertsCorrectlyWithBiasCheckHidden) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine( g, params, {trt_input, trt_h0, trt_w_ih, trt_w_hh, trt_b_ih, trt_b_hh}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-5)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenGRUCellConvertsCorrectlyWithoutBiasCheckHidden) { @@ -88,8 +87,7 @@ TEST(Converters, ATenGRUCellConvertsCorrectlyWithoutBiasCheckHidden) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_input, trt_h0, trt_w_ih, trt_w_hh}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-5)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenLSTMCellConvertsCorrectlyWithBiasCheckHidden) { @@ -140,8 +138,7 @@ TEST(Converters, ATenLSTMCellConvertsCorrectlyWithBiasCheckHidden) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine( g, params, {trt_input, trt_h0, trt_c0, trt_w_ih, trt_w_hh, trt_b_ih, trt_b_hh}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-5)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenLSTMCellConvertsCorrectlyWithBiasCheckCell) { @@ -192,8 +189,7 @@ TEST(Converters, ATenLSTMCellConvertsCorrectlyWithBiasCheckCell) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine( g, params, {trt_input, trt_h0, trt_c0, trt_w_ih, trt_w_hh, trt_b_ih, trt_b_hh}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-5)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenLSTMCellConvertsCorrectlyWithoutBiasCheckHidden) { @@ -237,8 +233,7 @@ TEST(Converters, ATenLSTMCellConvertsCorrectlyWithoutBiasCheckHidden) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_input, trt_h0, trt_c0, trt_w_ih, trt_w_hh}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-5)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenLSTMCellConvertsCorrectlyWithoutBiasCheckCell) { @@ -282,8 +277,7 @@ TEST(Converters, ATenLSTMCellConvertsCorrectlyWithoutBiasCheckCell) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_input, trt_h0, trt_c0, trt_w_ih, trt_w_hh}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-5)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } #endif diff --git a/tests/core/conversion/converters/test_masked_fill.cpp b/tests/core/conversion/converters/test_masked_fill.cpp index 0931112a5e..c12fcf1b51 100644 --- a/tests/core/conversion/converters/test_masked_fill.cpp +++ b/tests/core/conversion/converters/test_masked_fill.cpp @@ -39,8 +39,7 @@ TEST(Converters, ATenMaskedFillZerosConvertsCorrectly) { torch_tensorrt::core::lowering::passes::RemoveNOPs(g); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenMaskedFillZerosDynamicConvertsCorrectly) { @@ -98,8 +97,7 @@ TEST(Converters, ATenMaskedFillMixedTypesFloatIntConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1, in2}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); // Ensure data types match in outputs ASSERT_TRUE(jit_results[0].dtype() == trt_results[0].dtype()); @@ -126,8 +124,7 @@ TEST(Converters, ATenMaskedFillMixedTypesIntFloatConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1, in2}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); // Ensure data types match in outputs ASSERT_TRUE(jit_results[0].dtype() == trt_results[0].dtype()); diff --git a/tests/core/conversion/converters/test_matrix_multiply.cpp b/tests/core/conversion/converters/test_matrix_multiply.cpp index 50248f379a..fe5a9af391 100644 --- a/tests/core/conversion/converters/test_matrix_multiply.cpp +++ b/tests/core/conversion/converters/test_matrix_multiply.cpp @@ -22,7 +22,7 @@ TEST(Converters, ATenMMConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1, in2}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenMMWithDiffShapesConvertsCorrectly) { @@ -42,7 +42,7 @@ TEST(Converters, ATenMMWithDiffShapesConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1, in2}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenMM1d2dConvertsCorrectly) { @@ -62,7 +62,7 @@ TEST(Converters, ATenMM1d2dConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1, in2}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenMM1d3dConvertsCorrectly) { @@ -82,7 +82,7 @@ TEST(Converters, ATenMM1d3dConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1, in2}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenMM1d4dConvertsCorrectly) { @@ -102,7 +102,7 @@ TEST(Converters, ATenMM1d4dConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1, in2}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenMM3d1dConvertsCorrectly) { @@ -123,7 +123,7 @@ TEST(Converters, ATenMM3d1dConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1, in2}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenMM2d1dConvertsCorrectly) { @@ -144,7 +144,7 @@ TEST(Converters, ATenMM2d1dConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1, in2}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenMM4d1dConvertsCorrectly) { @@ -165,7 +165,7 @@ TEST(Converters, ATenMM4d1dConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1, in2}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenBMMConvertsCorrectly) { @@ -185,7 +185,7 @@ TEST(Converters, ATenBMMConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1, in2}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenBADDBMMConvertsCorrectly) { @@ -208,7 +208,7 @@ TEST(Converters, ATenBADDBMMConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {self, bat1, bat2}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenBADDBMMAlphaBetaDisabledConvertsCorrectly) { @@ -231,7 +231,7 @@ TEST(Converters, ATenBADDBMMAlphaBetaDisabledConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {self, bat1, bat2}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenBADDBMMScalarDefaultsConvertsCorrectly) { @@ -254,5 +254,5 @@ TEST(Converters, ATenBADDBMMScalarDefaultsConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {self, bat1, bat2}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } diff --git a/tests/core/conversion/converters/test_max.cpp b/tests/core/conversion/converters/test_max.cpp index 30111edf36..2c36d37986 100644 --- a/tests/core/conversion/converters/test_max.cpp +++ b/tests/core/conversion/converters/test_max.cpp @@ -23,10 +23,8 @@ TEST(Converters, ATenMaxDimConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[1], trt_results[1].reshape_as(jit_results[1]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[1], trt_results[1].reshape_as(jit_results[1]))); } TEST(Converters, ATenMaxDimIntInputConvertsCorrectly) { @@ -48,8 +46,8 @@ TEST(Converters, ATenMaxDimIntInputConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[1], trt_results[1], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[1], trt_results[1])); } TEST(Converters, ATenMinDimConvertsCorrectly) { @@ -71,10 +69,8 @@ TEST(Converters, ATenMinDimConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[1], trt_results[1].reshape_as(jit_results[1]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[1], trt_results[1].reshape_as(jit_results[1]))); } TEST(Converters, ATenArgMaxConvertsCorrectly) { @@ -96,8 +92,7 @@ TEST(Converters, ATenArgMaxConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenArgMaxIntInputConvertsCorrectly) { @@ -119,7 +114,7 @@ TEST(Converters, ATenArgMaxIntInputConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenArgMaxKeepdimConvertsCorrectly) { @@ -141,8 +136,7 @@ TEST(Converters, ATenArgMaxKeepdimConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenArgMinConvertsCorrectly) { @@ -164,8 +158,7 @@ TEST(Converters, ATenArgMinConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenArgMinKeepdimConvertsCorrectly) { @@ -187,6 +180,5 @@ TEST(Converters, ATenArgMinKeepdimConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } diff --git a/tests/core/conversion/converters/test_normalize.cpp b/tests/core/conversion/converters/test_normalize.cpp index b665c0b6fb..8c86ab2a6a 100644 --- a/tests/core/conversion/converters/test_normalize.cpp +++ b/tests/core/conversion/converters/test_normalize.cpp @@ -21,7 +21,7 @@ \ auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); \ auto trt = trt_results[0].reshape(jit_results[0].sizes()); \ - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); \ + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); \ } \ \ TEST(Converters, name##DynamicConvertsCorrectly) { \ @@ -40,7 +40,7 @@ \ auto trt_results = torch_tensorrt::tests::util::RunGraphEngineDynamic(g, params, {trt_in}); \ auto trt = trt_results[0].reshape(jit_results[0].sizes()); \ - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); \ + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); \ } ATEN_INTERPOLATE_TESTS( diff --git a/tests/core/conversion/converters/test_pooling.cpp b/tests/core/conversion/converters/test_pooling.cpp index 743f786c0c..1f9d500b50 100644 --- a/tests/core/conversion/converters/test_pooling.cpp +++ b/tests/core/conversion/converters/test_pooling.cpp @@ -28,7 +28,7 @@ TEST(Converters, ATenMaxPool1DConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenMaxPool1DConvertsCorrectlyWithDynamicInput) { @@ -55,7 +55,7 @@ TEST(Converters, ATenMaxPool1DConvertsCorrectlyWithDynamicInput) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngineDynamic(g, params, {in}, true); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenMaxPool2DConvertsCorrectly) { @@ -83,7 +83,7 @@ TEST(Converters, ATenMaxPool2DConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenMaxPool2DConvertsCorrectlyWithDynamicInput) { @@ -111,7 +111,7 @@ TEST(Converters, ATenMaxPool2DConvertsCorrectlyWithDynamicInput) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngineDynamic(g, params, {in}, false); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenMaxPool3DConvertsCorrectly) { @@ -139,7 +139,7 @@ TEST(Converters, ATenMaxPool3DConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenAvgPool1DConvertsCorrectly) { @@ -169,7 +169,7 @@ TEST(Converters, ATenAvgPool1DConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenAvgPool1DCeilConvertsCorrectly) { @@ -198,7 +198,7 @@ TEST(Converters, ATenAvgPool1DCeilConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenAvgPool1DNoCountPadConvertsCorrectly) { @@ -227,7 +227,7 @@ TEST(Converters, ATenAvgPool1DNoCountPadConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenAvgPool2DConvertsCorrectly) { @@ -257,7 +257,7 @@ TEST(Converters, ATenAvgPool2DConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenAvgPool2DCeilConvertsCorrectly) { @@ -287,7 +287,7 @@ TEST(Converters, ATenAvgPool2DCeilConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenAvgPool2DNoCountPadConvertsCorrectly) { @@ -317,7 +317,7 @@ TEST(Converters, ATenAvgPool2DNoCountPadConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenAvgPool3DConvertsCorrectly) { @@ -347,7 +347,7 @@ TEST(Converters, ATenAvgPool3DConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenAvgPool3DCeilConvertsCorrectly) { @@ -377,7 +377,7 @@ TEST(Converters, ATenAvgPool3DCeilConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenAvgPool3DNoCountPadConvertsCorrectly) { @@ -407,7 +407,7 @@ TEST(Converters, ATenAvgPool3DNoCountPadConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenAdaptiveAvgPool2DConvertsCorrectly) { @@ -433,7 +433,7 @@ TEST(Converters, ATenAdaptiveAvgPool2DConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenAdaptiveAvgPool2DGlobalPoolingConvertsCorrectly) { @@ -459,7 +459,7 @@ TEST(Converters, ATenAdaptiveAvgPool2DGlobalPoolingConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenAdaptiveAvgPool2DConvertsCorrectlyWithDynamicInput) { @@ -485,7 +485,7 @@ TEST(Converters, ATenAdaptiveAvgPool2DConvertsCorrectlyWithDynamicInput) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngineDynamic(g, params, {trt_in}, false); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenAdaptiveAvgPool1DConvertsCorrectly) { @@ -537,7 +537,7 @@ TEST(Converters, ATenAdaptiveAvgPool1DGlobalPoolingConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenAdaptiveAvgPool1DUsingPluginConvertsCorrectly) { @@ -563,7 +563,7 @@ TEST(Converters, ATenAdaptiveAvgPool1DUsingPluginConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenAdaptiveMaxPool1DGlobalPoolingConvertsCorrectly) { @@ -589,7 +589,7 @@ TEST(Converters, ATenAdaptiveMaxPool1DGlobalPoolingConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenAdaptiveMaxPool1DUsingPluginConvertsCorrectly) { @@ -615,7 +615,7 @@ TEST(Converters, ATenAdaptiveMaxPool1DUsingPluginConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenAdaptiveMaxPool2DConvertsCorrectly) { @@ -641,7 +641,7 @@ TEST(Converters, ATenAdaptiveMaxPool2DConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenAdaptiveMaxPool2DConvertsCorrectlyWithDynamicInput) { @@ -667,7 +667,7 @@ TEST(Converters, ATenAdaptiveMaxPool2DConvertsCorrectlyWithDynamicInput) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngineDynamic(g, params, {trt_in}, false); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenAdaptiveAvgPool3DGlobalPoolingConvertsCorrectly) { @@ -695,7 +695,7 @@ TEST(Converters, ATenAdaptiveAvgPool3DGlobalPoolingConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenAdaptiveAvgPool3DUsingPluginConvertsCorrectly) { @@ -723,7 +723,7 @@ TEST(Converters, ATenAdaptiveAvgPool3DUsingPluginConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenAdaptiveMaxPool3DGlobalPoolingConvertsCorrectly) { @@ -751,7 +751,7 @@ TEST(Converters, ATenAdaptiveMaxPool3DGlobalPoolingConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenAdaptiveMaxPool3DUsingPluginConvertsCorrectly) { @@ -779,5 +779,5 @@ TEST(Converters, ATenAdaptiveMaxPool3DUsingPluginConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } diff --git a/tests/core/conversion/converters/test_quantization.cpp b/tests/core/conversion/converters/test_quantization.cpp index d6881bb37e..f1040afda1 100644 --- a/tests/core/conversion/converters/test_quantization.cpp +++ b/tests/core/conversion/converters/test_quantization.cpp @@ -26,8 +26,7 @@ TEST(Converters, ATenFakeQuantizePerTensorConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}, nvinfer1::DataType::kINT8); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenFakeQuantizePerTensorWithParamsConvertsCorrectly) { @@ -61,7 +60,7 @@ TEST(Converters, ATenFakeQuantizePerTensorWithParamsConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}, nvinfer1::DataType::kINT8); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenFakeQuantizePerChannelConvertsCorrectly) { @@ -94,6 +93,5 @@ TEST(Converters, ATenFakeQuantizePerChannelConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}, nvinfer1::DataType::kINT8); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } diff --git a/tests/core/conversion/converters/test_reduce.cpp b/tests/core/conversion/converters/test_reduce.cpp index 3cdb2d3b84..5e75723fbe 100644 --- a/tests/core/conversion/converters/test_reduce.cpp +++ b/tests/core/conversion/converters/test_reduce.cpp @@ -77,7 +77,7 @@ void test_body(const std::string& graph, at::Tensor& in, bool dynamic = false) { } else { trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); } - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } } // namespace diff --git a/tests/core/conversion/converters/test_reflection_pad.cpp b/tests/core/conversion/converters/test_reflection_pad.cpp index ad7eb40539..4ae89958b5 100644 --- a/tests/core/conversion/converters/test_reflection_pad.cpp +++ b/tests/core/conversion/converters/test_reflection_pad.cpp @@ -27,8 +27,7 @@ TEST(Converters, ATenReflection_pad2dTensorConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenReflection_pad1dTensorConvertsCorrectly) { @@ -51,6 +50,5 @@ TEST(Converters, ATenReflection_pad1dTensorConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } diff --git a/tests/core/conversion/converters/test_replication_pad.cpp b/tests/core/conversion/converters/test_replication_pad.cpp index c16619e888..0c825ef3aa 100644 --- a/tests/core/conversion/converters/test_replication_pad.cpp +++ b/tests/core/conversion/converters/test_replication_pad.cpp @@ -23,8 +23,7 @@ TEST(Converters, ATenReplication_pad1dTensorConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenReplication_pad1dRightZeroTensorConvertsCorrectly) { @@ -45,8 +44,7 @@ TEST(Converters, ATenReplication_pad1dRightZeroTensorConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenReplication_pad1dTensorConvertsCorrectlyWithDynamic) { @@ -67,8 +65,7 @@ TEST(Converters, ATenReplication_pad1dTensorConvertsCorrectlyWithDynamic) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngineDynamic(g, params, {in1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenReplication_pad2dTensorConvertsCorrectly) { @@ -89,8 +86,7 @@ TEST(Converters, ATenReplication_pad2dTensorConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenReplication_pad2dRightBottomZeroTensorConvertsCorrectly) { @@ -111,8 +107,7 @@ TEST(Converters, ATenReplication_pad2dRightBottomZeroTensorConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenReplication_pad2dTensorConvertsCorrectlyWithDynamic) { @@ -133,8 +128,7 @@ TEST(Converters, ATenReplication_pad2dTensorConvertsCorrectlyWithDynamic) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngineDynamic(g, params, {in1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenReplication_pad3dTensorConvertsCorrectly) { @@ -155,8 +149,7 @@ TEST(Converters, ATenReplication_pad3dTensorConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenReplication_pad3dRightBottomBackZeroTensorConvertsCorrectly) { @@ -177,8 +170,7 @@ TEST(Converters, ATenReplication_pad3dRightBottomBackZeroTensorConvertsCorrectly params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenReplication_pad3dTensorConvertsCorrectlyWithDynamic) { @@ -199,6 +191,5 @@ TEST(Converters, ATenReplication_pad3dTensorConvertsCorrectlyWithDynamic) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngineDynamic(g, params, {in1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } diff --git a/tests/core/conversion/converters/test_roll.cpp b/tests/core/conversion/converters/test_roll.cpp index 693fd47aef..75a7ce9440 100644 --- a/tests/core/conversion/converters/test_roll.cpp +++ b/tests/core/conversion/converters/test_roll.cpp @@ -28,7 +28,7 @@ TEST(Converters, ATenRollConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenRollShiftsNegativeConvertsCorrectly) { @@ -54,7 +54,7 @@ TEST(Converters, ATenRollShiftsNegativeConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenRollDimsNegativeConvertsCorrectly) { @@ -80,5 +80,5 @@ TEST(Converters, ATenRollDimsNegativeConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } \ No newline at end of file diff --git a/tests/core/conversion/converters/test_scaled_dot_product_attention.cpp b/tests/core/conversion/converters/test_scaled_dot_product_attention.cpp index 5550d5409b..6809472529 100644 --- a/tests/core/conversion/converters/test_scaled_dot_product_attention.cpp +++ b/tests/core/conversion/converters/test_scaled_dot_product_attention.cpp @@ -29,7 +29,7 @@ TEST(Converters, ATenScaledDotProductAttentionConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {query, key, value}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 1e-5)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenScaledDotProductAttnMaskFloatConvertsCorrectly) { @@ -56,7 +56,7 @@ TEST(Converters, ATenScaledDotProductAttnMaskFloatConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {query, key, value, attn_mask}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 1e-5)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenScaledDotProductAttnMaskBoolConvertsCorrectly) { @@ -83,5 +83,5 @@ TEST(Converters, ATenScaledDotProductAttnMaskBoolConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {query, key, value, attn_mask}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 1e-5)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } diff --git a/tests/core/conversion/converters/test_scatter.cpp b/tests/core/conversion/converters/test_scatter.cpp index b7d0883249..0eb744e8b4 100644 --- a/tests/core/conversion/converters/test_scatter.cpp +++ b/tests/core/conversion/converters/test_scatter.cpp @@ -36,7 +36,7 @@ TEST(Converters, ScatterValueConvertsCorrectly) { for (size_t i = 0; i < jit_results.size(); i++) { auto trt = trt_results[i].reshape(jit_results[i].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt)); } } @@ -74,6 +74,6 @@ TEST(Converters, ScatterSrcConvertsCorrectly) { for (size_t i = 0; i < jit_results.size(); i++) { auto trt = trt_results[i].reshape(jit_results[i].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt)); } } \ No newline at end of file diff --git a/tests/core/conversion/converters/test_select.cpp b/tests/core/conversion/converters/test_select.cpp index 4de4dc10a1..c6152a3d4d 100644 --- a/tests/core/conversion/converters/test_select.cpp +++ b/tests/core/conversion/converters/test_select.cpp @@ -29,7 +29,7 @@ TEST(Converters, ATenSelectIntConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenSelectIntDynamicConvertsCorrectly) { @@ -55,7 +55,7 @@ TEST(Converters, ATenSelectIntDynamicConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenSelectIntDimIsOneConvertsCorrectly) { @@ -83,7 +83,7 @@ TEST(Converters, ATenSelectIntDimIsOneConvertsCorrectly) { // In order to check whether shape match that we don't do reshape. // E.g. x = at::randint(1, 10, {4, 4, 4}, {at::kCUDA}), then aten::select(x, 1, 0). We should get a tensor y with // shape {4, 4} instead of a tensor with shape {4, 1, 4}. - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenSelectIntDimNegativeConvertsCorrectly) { @@ -108,7 +108,7 @@ TEST(Converters, ATenSelectIntDimNegativeConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenSelectIntNegIndexConvertsCorrectly) { @@ -135,7 +135,7 @@ TEST(Converters, ATenSelectIntNegIndexConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenSelectIntTwiceConvertsCorrectly) { @@ -163,7 +163,7 @@ TEST(Converters, ATenSelectIntTwiceConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenSelectEmptyTensorConvertsCorrectly) { @@ -215,7 +215,7 @@ TEST(Converters, ATenNarrowStartScalarConvertsCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenEmbeddingConvertsCorrectly) { @@ -243,5 +243,5 @@ TEST(Converters, ATenEmbeddingConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } diff --git a/tests/core/conversion/converters/test_shuffle.cpp b/tests/core/conversion/converters/test_shuffle.cpp index a4d22e10c6..588db36583 100644 --- a/tests/core/conversion/converters/test_shuffle.cpp +++ b/tests/core/conversion/converters/test_shuffle.cpp @@ -23,7 +23,7 @@ TEST(Converters, ATenFlattenConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenFlattenNegDimsConvertsCorrectly) { @@ -45,7 +45,7 @@ TEST(Converters, ATenFlattenNegDimsConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenFlattenOtherDimsConvertsCorrectly) { @@ -67,7 +67,7 @@ TEST(Converters, ATenFlattenOtherDimsConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenReshapeConvertsCorrectly) { @@ -91,7 +91,7 @@ TEST(Converters, ATenReshapeConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); auto trt = trt_results[0].reshape_as(jit_results[0]); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenViewConvertsCorrectly) { @@ -115,7 +115,7 @@ TEST(Converters, ATenViewConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); auto trt = trt_results[0].reshape_as(jit_results[0]); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenPermuteConvertsCorrectly) { @@ -140,7 +140,7 @@ TEST(Converters, ATenPermuteConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); auto trt = trt_results[0].reshape_as(jit_results[0]); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenPermute3DConvertsCorrectly) { @@ -162,7 +162,7 @@ TEST(Converters, ATenPermute3DConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); auto trt = trt_results[0].reshape_as(jit_results[0]); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenPermute5DConvertsCorrectly) { @@ -184,7 +184,7 @@ TEST(Converters, ATenPermute5DConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); auto trt = trt_results[0].reshape_as(jit_results[0]); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenFlattenConvertsCorrectlyWithDynamicInput) { @@ -207,7 +207,7 @@ TEST(Converters, ATenFlattenConvertsCorrectlyWithDynamicInput) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngineDynamic(g, params, {in}, false); auto trt = trt_results[0].reshape_as(jit_results[0]); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenFlattenConvertsCorrectlyWithDynamicBatch) { @@ -230,7 +230,7 @@ TEST(Converters, ATenFlattenConvertsCorrectlyWithDynamicBatch) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngineDynamic(g, params, {in}, true); auto trt = trt_results[0].reshape_as(jit_results[0]); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenFlattenNegDimsConvertsCorrectlyWithDynamicBatch) { @@ -253,7 +253,7 @@ TEST(Converters, ATenFlattenNegDimsConvertsCorrectlyWithDynamicBatch) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngineDynamic(g, params, {in}, true); auto trt = trt_results[0].reshape_as(jit_results[0]); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenTransposeConvertsCorrectly) { @@ -279,7 +279,7 @@ TEST(Converters, ATenTransposeConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); auto trt = trt_results[0].reshape_as(jit_results[0]); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenTConvertsCorrectly) { @@ -303,7 +303,7 @@ TEST(Converters, ATenTConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); auto trt = trt_results[0].reshape_as(jit_results[0]); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenTransposeNegativeConvertsCorrectly) { @@ -329,7 +329,7 @@ TEST(Converters, ATenTransposeNegativeConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); auto trt = trt_results[0].reshape_as(jit_results[0]); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenPixelShuffleConvertsCorrectly) { @@ -354,7 +354,7 @@ TEST(Converters, ATenPixelShuffleConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); // auto trt = trt_results[0].reshape_as(jit_results[0]); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenPixelShuffle3DConvertsCorrectly) { @@ -378,7 +378,7 @@ TEST(Converters, ATenPixelShuffle3DConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenPixelShuffle5DConvertsCorrectly) { @@ -403,7 +403,7 @@ TEST(Converters, ATenPixelShuffle5DConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); // auto trt = trt_results[0].reshape_as(jit_results[0]); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenUnflattenConvertsCorrectly) { @@ -429,7 +429,7 @@ TEST(Converters, ATenUnflattenConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenUnflattenNegativeDimConvertsCorrectly) { @@ -455,5 +455,5 @@ TEST(Converters, ATenUnflattenNegativeDimConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } \ No newline at end of file diff --git a/tests/core/conversion/converters/test_slice.cpp b/tests/core/conversion/converters/test_slice.cpp index ac252459a4..23ba683c9f 100644 --- a/tests/core/conversion/converters/test_slice.cpp +++ b/tests/core/conversion/converters/test_slice.cpp @@ -33,7 +33,7 @@ TEST(Converters, ATenSliceConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenSliceNegStartIndexConvertsCorrectly) { @@ -61,7 +61,7 @@ TEST(Converters, ATenSliceNegStartIndexConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenSliceNegEndIndexConvertsCorrectly) { @@ -94,7 +94,7 @@ TEST(Converters, ATenSliceNegEndIndexConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenSliceListConvertsCorrectly) { @@ -125,7 +125,7 @@ TEST(Converters, ATenSliceListConvertsCorrectly) { for (size_t i = 0; i < jit_results.size(); i++) { auto trt = trt_results[i].reshape(jit_results[i].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt)); } } @@ -155,7 +155,7 @@ TEST(Converters, ATenSliceDynamicBatchConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngineDynamic(g, params, {trt_in}, true); auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenSliceDynamicBatchLargeEndConvertsCorrectly) { @@ -184,7 +184,7 @@ TEST(Converters, ATenSliceDynamicBatchLargeEndConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngineDynamic(g, params, {trt_in}, true); auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenSliceDynamicNegStartBatchConvertsCorrectly) { @@ -213,7 +213,7 @@ TEST(Converters, ATenSliceDynamicNegStartBatchConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngineDynamic(g, params, {trt_in}, true); auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenSliceDynamicNegEndBatchConvertsCorrectly) { @@ -242,7 +242,7 @@ TEST(Converters, ATenSliceDynamicNegEndBatchConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngineDynamic(g, params, {trt_in}, true); auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenSliceDynamicNoneBatchConvertsCorrectly) { @@ -270,7 +270,7 @@ TEST(Converters, ATenSliceDynamicNoneBatchConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngineDynamic(g, params, {trt_in}, true); auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenSliceDynamicConvertsCorrectly) { @@ -299,7 +299,7 @@ TEST(Converters, ATenSliceDynamicConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngineDynamic(g, params, {trt_in}, false); auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenSliceDynamic2ConvertsCorrectly) { @@ -328,7 +328,7 @@ TEST(Converters, ATenSliceDynamic2ConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngineDynamic(g, params, {trt_in}, true); auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenFlipConvertsCorrectly) { @@ -355,6 +355,6 @@ TEST(Converters, ATenFlipConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngineDynamic(g, params, {trt_in}, true); for (size_t i = 0; i < jit_results.size(); i++) { - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt_results[i], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt_results[i])); } } diff --git a/tests/core/conversion/converters/test_softmax.cpp b/tests/core/conversion/converters/test_softmax.cpp index fde4bf7ccf..d0ef498f01 100644 --- a/tests/core/conversion/converters/test_softmax.cpp +++ b/tests/core/conversion/converters/test_softmax.cpp @@ -26,7 +26,7 @@ TEST(Converters, ATenSoftmax1DConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); auto trt = trt_results[0].reshape_as(jit_results[0]); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenSoftmaxNDConvertsCorrectlySub3DIndex) { @@ -50,7 +50,7 @@ TEST(Converters, ATenSoftmaxNDConvertsCorrectlySub3DIndex) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); auto trt = trt_results[0].reshape_as(jit_results[0]); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenSoftmaxNDConvertsCorrectlyAbove3DIndex) { @@ -76,7 +76,7 @@ TEST(Converters, ATenSoftmaxNDConvertsCorrectlyAbove3DIndex) { auto trt = trt_results[0].reshape_as(jit_results[0]); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenSoftmaxNDConvertsCorrectlyNegtiveOneIndex) { @@ -102,7 +102,7 @@ TEST(Converters, ATenSoftmaxNDConvertsCorrectlyNegtiveOneIndex) { auto trt = trt_results[0].reshape_as(jit_results[0]); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenSoftmaxNDConvertsCorrectlyNegtiveIndex) { @@ -128,6 +128,6 @@ TEST(Converters, ATenSoftmaxNDConvertsCorrectlyNegtiveIndex) { auto trt = trt_results[0].reshape_as(jit_results[0]); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } #endif diff --git a/tests/core/conversion/converters/test_split.cpp b/tests/core/conversion/converters/test_split.cpp index 87bd5a16e0..a8577a4e8b 100644 --- a/tests/core/conversion/converters/test_split.cpp +++ b/tests/core/conversion/converters/test_split.cpp @@ -29,7 +29,7 @@ TEST(Converters, ATenSplitSizesInScriptingConvertsCorrectly) { for (size_t i = 0; i < jit_results.size(); i++) { auto trt = trt_results[i].reshape(jit_results[i].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt)); } } @@ -57,7 +57,7 @@ TEST(Converters, ATenSplitSizesinTracingConvertsCorrectly) { for (size_t i = 0; i < jit_results.size(); i++) { auto trt = trt_results[i].reshape(jit_results[i].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt)); } } @@ -84,7 +84,7 @@ TEST(Converters, ATenSplitFixedConvertsCorrectly) { for (size_t i = 0; i < jit_results.size(); i++) { auto trt = trt_results[i].reshape(jit_results[i].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt)); } } @@ -112,7 +112,7 @@ TEST(Converters, ATenSplitFixedHasRemainderConvertsCorrectly) { for (size_t i = 0; i < jit_results.size(); i++) { auto trt = trt_results[i].reshape(jit_results[i].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt)); } } @@ -141,7 +141,7 @@ TEST(Converters, ATenSplitAndAddConvertsCorrectly) { for (size_t i = 0; i < jit_results.size(); i++) { auto trt = trt_results[i].reshape(jit_results[i].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt)); } } @@ -169,6 +169,6 @@ TEST(Converters, ATenSplitNegativeDimsConvertsCorrectly) { for (size_t i = 0; i < jit_results.size(); i++) { auto trt = trt_results[i].reshape(jit_results[i].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt)); } } \ No newline at end of file diff --git a/tests/core/conversion/converters/test_squeeze.cpp b/tests/core/conversion/converters/test_squeeze.cpp index 09334710b6..20ebe6a4e8 100644 --- a/tests/core/conversion/converters/test_squeeze.cpp +++ b/tests/core/conversion/converters/test_squeeze.cpp @@ -22,8 +22,7 @@ TEST(Converters, ATenSqueezeConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenSqueezeDontNeedSqueezeConvertsCorrectly) { @@ -53,8 +52,7 @@ TEST(Converters, ATenSqueezeDontNeedSqueezeConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in, trt_in_add}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenSqueezeNoDimConvertsCorrectly) { @@ -72,7 +70,7 @@ TEST(Converters, ATenSqueezeNoDimConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); }; validate_squeeze_with_input(at::randint(1, 10, {2, 1, 3, 3}, {at::kCUDA})); diff --git a/tests/core/conversion/converters/test_topk.cpp b/tests/core/conversion/converters/test_topk.cpp index c1f651b3bc..70e8edb1c1 100644 --- a/tests/core/conversion/converters/test_topk.cpp +++ b/tests/core/conversion/converters/test_topk.cpp @@ -36,10 +36,8 @@ TEST(Converters, ATenTopKConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 8e-5)); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[1], trt_results[1].reshape_as(jit_results[1]), 8e-5)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[1], trt_results[1].reshape_as(jit_results[1]))); } TEST(Converters, ATen1DTopKConvertsCorrectly) { @@ -64,6 +62,6 @@ TEST(Converters, ATen1DTopKConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 8e-5)); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[1], trt_results[1], 8e-5)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[1], trt_results[1])); } diff --git a/tests/core/conversion/converters/test_unary.cpp b/tests/core/conversion/converters/test_unary.cpp index 1c1acbc016..c7359c0d60 100644 --- a/tests/core/conversion/converters/test_unary.cpp +++ b/tests/core/conversion/converters/test_unary.cpp @@ -75,8 +75,7 @@ TEST(Converters, ATenSignConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenSignConvertsZerosCorrectly) { @@ -92,8 +91,7 @@ TEST(Converters, ATenSignConvertsZerosCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenLogicalNotBoolConvertsCorrectly) { @@ -108,7 +106,7 @@ TEST(Converters, ATenLogicalNotBoolConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenSqrtIntConvertsCorrectly) { @@ -123,7 +121,7 @@ TEST(Converters, ATenSqrtIntConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenFiniteConvertsCorrectly) { @@ -144,28 +142,28 @@ TEST(Converters, ATenFiniteConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } -#define test_unary(unary, name) \ - TEST(Converters, ATen##name##ConvertsCorrectly) { \ - const auto graph = gen_test_graph(#unary); \ - \ - auto g = std::make_shared(); \ - torch::jit::parseIR(graph, g.get()); \ - \ - float offset = 0; \ - if (strcmp(#name, "Acosh") == 0) \ - offset += 1; /*input larger than 1 for acosh*/ \ - auto in = at::empty({10}, {at::kCUDA}).uniform_(0 + offset, 0.5 + offset); \ - auto params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); \ - auto jit_results = torch_tensorrt::tests::util::RunGraph(g, params, {in}); \ - \ - in = at::clone(in); \ - params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); \ - auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); \ - \ - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); \ +#define test_unary(unary, name) \ + TEST(Converters, ATen##name##ConvertsCorrectly) { \ + const auto graph = gen_test_graph(#unary); \ + \ + auto g = std::make_shared(); \ + torch::jit::parseIR(graph, g.get()); \ + \ + float offset = 0; \ + if (strcmp(#name, "Acosh") == 0) \ + offset += 1; /*input larger than 1 for acosh*/ \ + auto in = at::empty({10}, {at::kCUDA}).uniform_(0 + offset, 0.5 + offset); \ + auto params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); \ + auto jit_results = torch_tensorrt::tests::util::RunGraph(g, params, {in}); \ + \ + in = at::clone(in); \ + params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); \ + auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); \ + \ + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); \ } test_unary(cos, Cos); diff --git a/tests/core/conversion/converters/test_unbind.cpp b/tests/core/conversion/converters/test_unbind.cpp index 0062a055bb..682e1d2114 100644 --- a/tests/core/conversion/converters/test_unbind.cpp +++ b/tests/core/conversion/converters/test_unbind.cpp @@ -28,7 +28,7 @@ TEST(Converters, ATenUnbindConvertsCorrectly) { for (size_t i = 0; i < jit_results.size(); i++) { auto trt = trt_results[i]; - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt)); } } @@ -55,7 +55,7 @@ TEST(Converters, ATenUnbindNegativeAxisConvertsCorrectly) { for (size_t i = 0; i < jit_results.size(); i++) { auto trt = trt_results[i]; - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i], trt)); } } @@ -83,6 +83,6 @@ TEST(Converters, ATenUnbindEvaluatedTensor) { for (size_t i = 0; i < jit_results.size(); i++) { auto trt = trt_results[i]; - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i].cuda(), trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[i].cuda(), trt)); } } \ No newline at end of file diff --git a/tests/core/conversion/converters/test_unpack.cpp b/tests/core/conversion/converters/test_unpack.cpp index 858462b003..f7d7463fe9 100644 --- a/tests/core/conversion/converters/test_unpack.cpp +++ b/tests/core/conversion/converters/test_unpack.cpp @@ -30,7 +30,7 @@ TEST(Converters, UnpackVarLowersCorrectly) { torch::jit::EliminateCommonSubexpression(g); params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, UnpackVarKeepDimsLowersCorrectly) { @@ -56,7 +56,7 @@ TEST(Converters, UnpackVarKeepDimsLowersCorrectly) { torch::jit::EliminateCommonSubexpression(g); params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, UnpackVarUnbiasedLowersCorrectly) { @@ -82,7 +82,7 @@ TEST(Converters, UnpackVarUnbiasedLowersCorrectly) { torch::jit::EliminateCommonSubexpression(g); params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, UnpackVarUnbiasedKeepDimsLowersCorrectly) { @@ -108,7 +108,7 @@ TEST(Converters, UnpackVarUnbiasedKeepDimsLowersCorrectly) { torch::jit::EliminateCommonSubexpression(g); params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, UnpackStdLowersCorrectly) { @@ -134,7 +134,7 @@ TEST(Converters, UnpackStdLowersCorrectly) { torch_tensorrt::core::lowering::passes::UnpackVar(g); params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, UnpackStdKeepDimsLowersCorrectly) { @@ -160,7 +160,7 @@ TEST(Converters, UnpackStdKeepDimsLowersCorrectly) { torch_tensorrt::core::lowering::passes::UnpackVar(g); params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, UnpackStdUnbiasedLowersCorrectly) { @@ -187,7 +187,7 @@ TEST(Converters, UnpackStdUnbiasedLowersCorrectly) { torch::jit::EliminateCommonSubexpression(g); params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, UnpackStdUnbiasedKeepDimsLowersCorrectly) { @@ -215,7 +215,7 @@ TEST(Converters, UnpackStdUnbiasedKeepDimsLowersCorrectly) { torch::jit::EliminateCommonSubexpression(g); params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, UnpackVarUnbiasedNegAxisLowersCorrectly) { @@ -241,5 +241,5 @@ TEST(Converters, UnpackVarUnbiasedNegAxisLowersCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {jit_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } \ No newline at end of file diff --git a/tests/core/conversion/converters/test_unsqueeze.cpp b/tests/core/conversion/converters/test_unsqueeze.cpp index 88203ae5ad..0fc1e67973 100644 --- a/tests/core/conversion/converters/test_unsqueeze.cpp +++ b/tests/core/conversion/converters/test_unsqueeze.cpp @@ -22,8 +22,7 @@ TEST(Converters, ATenUnsqueezeConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenUnsqueezeNegativeDimConvertsCorrectly) { @@ -44,8 +43,7 @@ TEST(Converters, ATenUnsqueezeNegativeDimConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Converters, ATenUnsqueezeConvertsCorrectlyWithDynamicInput) { @@ -66,6 +64,5 @@ TEST(Converters, ATenUnsqueezeConvertsCorrectlyWithDynamicInput) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } diff --git a/tests/core/conversion/converters/test_where.cpp b/tests/core/conversion/converters/test_where.cpp index 34b3696582..6756a638cc 100644 --- a/tests/core/conversion/converters/test_where.cpp +++ b/tests/core/conversion/converters/test_where.cpp @@ -33,7 +33,7 @@ TEST(Converters, WhereConvertsCorrectly) { auto trt_y = at::clone(y); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_condition, trt_x, trt_y}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, WhereConvertsMismatchedShapesCorrectly) { @@ -65,5 +65,5 @@ TEST(Converters, WhereConvertsMismatchedShapesCorrectly) { auto trt_y = at::clone(y); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_condition, trt_x, trt_y}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } \ No newline at end of file diff --git a/tests/core/conversion/evaluators/test_aten_evaluators.cpp b/tests/core/conversion/evaluators/test_aten_evaluators.cpp index 6cf7319b18..f291b882a1 100644 --- a/tests/core/conversion/evaluators/test_aten_evaluators.cpp +++ b/tests/core/conversion/evaluators/test_aten_evaluators.cpp @@ -411,7 +411,7 @@ TEST(Evaluators, ATenArangeIntEvaluatesCorrectly) { auto jit_results = torch_tensorrt::tests::util::EvaluateGraphJIT(g, {}); auto trt_results = torch_tensorrt::tests::util::EvaluateGraph(g->block(), {}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0].toTensor(), trt_results[0].toTensor(), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0].toTensor(), trt_results[0].toTensor())); } TEST(Evaluators, ATenArangeFloatEvaluatesCorrectly) { @@ -427,7 +427,7 @@ TEST(Evaluators, ATenArangeFloatEvaluatesCorrectly) { auto jit_results = torch_tensorrt::tests::util::EvaluateGraphJIT(g, {}); auto trt_results = torch_tensorrt::tests::util::EvaluateGraph(g->block(), {}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0].toTensor(), trt_results[0].toTensor(), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0].toTensor(), trt_results[0].toTensor())); } TEST(Evaluators, ATenArangeStartEndIntEvaluatesCorrectly) { @@ -444,7 +444,7 @@ TEST(Evaluators, ATenArangeStartEndIntEvaluatesCorrectly) { auto jit_results = torch_tensorrt::tests::util::EvaluateGraphJIT(g, {}); auto trt_results = torch_tensorrt::tests::util::EvaluateGraph(g->block(), {}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0].toTensor(), trt_results[0].toTensor(), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0].toTensor(), trt_results[0].toTensor())); } TEST(Evaluators, ATenArangeStartEndFloatEvaluatesCorrectly) { @@ -461,7 +461,7 @@ TEST(Evaluators, ATenArangeStartEndFloatEvaluatesCorrectly) { auto jit_results = torch_tensorrt::tests::util::EvaluateGraphJIT(g, {}); auto trt_results = torch_tensorrt::tests::util::EvaluateGraph(g->block(), {}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0].toTensor(), trt_results[0].toTensor(), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0].toTensor(), trt_results[0].toTensor())); } TEST(Evaluators, ATenArangeStartEndStepIntEvaluatesCorrectly) { @@ -479,7 +479,7 @@ TEST(Evaluators, ATenArangeStartEndStepIntEvaluatesCorrectly) { auto jit_results = torch_tensorrt::tests::util::EvaluateGraphJIT(g, {}); auto trt_results = torch_tensorrt::tests::util::EvaluateGraph(g->block(), {}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0].toTensor(), trt_results[0].toTensor(), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0].toTensor(), trt_results[0].toTensor())); } TEST(Evaluators, ATenArangeStartEndStepFloatEvaluatesCorrectly) { @@ -497,7 +497,7 @@ TEST(Evaluators, ATenArangeStartEndStepFloatEvaluatesCorrectly) { auto jit_results = torch_tensorrt::tests::util::EvaluateGraphJIT(g, {}); auto trt_results = torch_tensorrt::tests::util::EvaluateGraph(g->block(), {}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0].toTensor(), trt_results[0].toTensor(), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0].toTensor(), trt_results[0].toTensor())); } TEST(Evaluators, ATenSizeNegativeConvertsCorrectly) { @@ -522,8 +522,7 @@ TEST(Evaluators, ATenSizeNegativeConvertsCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Evaluators, FloorIntIntEvaluatesCorrectly) { @@ -580,8 +579,7 @@ TEST(Evaluators, ATenExtendEvaluatesCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in0, in1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Evaluators, ATenAppendWithITensorEvaluatesCorrectly) { @@ -605,8 +603,7 @@ TEST(Evaluators, ATenAppendWithITensorEvaluatesCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in0, in1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Evaluators, ATenAppendWithTensorEvaluatesCorrectly) { @@ -636,8 +633,7 @@ TEST(Evaluators, ATenAppendWithTensorEvaluatesCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in0}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Evaluators, ATenAppendWithITensorAndTensorEvaluatesCorrectly) { @@ -664,8 +660,7 @@ TEST(Evaluators, ATenAppendWithITensorAndTensorEvaluatesCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in0}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Evaluators, SqrtIntEvaluatesCorrectly) { @@ -893,8 +888,7 @@ TEST(Evaluators, AtenFormatEvaluatesCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in0, in1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(Evaluators, AtenFormatRaiseExceptionEvaluatesCorrectly) { diff --git a/tests/core/lowering/test_conv_pass.cpp b/tests/core/lowering/test_conv_pass.cpp index d3bc9a385d..ae1e7138b4 100644 --- a/tests/core/lowering/test_conv_pass.cpp +++ b/tests/core/lowering/test_conv_pass.cpp @@ -59,7 +59,7 @@ TEST(LoweringPasses, Conv1dCorrectly) { params = torch_tensorrt::core::ir::get_static_params(tg->inputs(), {trt_w, trt_b}); auto trt_results_tg = torch_tensorrt::tests::util::RunGraphEngine(tg, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(trt_results_sg[0], trt_results_tg[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(trt_results_sg[0], trt_results_tg[0])); } TEST(LoweringPasses, ConvTransposed1dCorrectly) { @@ -117,7 +117,7 @@ TEST(LoweringPasses, ConvTransposed1dCorrectly) { params = torch_tensorrt::core::ir::get_static_params(tg->inputs(), {trt_w, trt_b}); auto trt_results_tg = torch_tensorrt::tests::util::RunGraphEngine(tg, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(trt_results_sg[0], trt_results_tg[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(trt_results_sg[0], trt_results_tg[0])); } TEST(LoweringPasses, Conv2dCorrectly) { @@ -172,7 +172,7 @@ TEST(LoweringPasses, Conv2dCorrectly) { params = torch_tensorrt::core::ir::get_static_params(tg->inputs(), {trt_w, trt_b}); auto trt_results_tg = torch_tensorrt::tests::util::RunGraphEngine(tg, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(trt_results_sg[0], trt_results_tg[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(trt_results_sg[0], trt_results_tg[0])); } TEST(LoweringPasses, ConvTransposed2dCorrectly) { @@ -227,7 +227,7 @@ TEST(LoweringPasses, ConvTransposed2dCorrectly) { params = torch_tensorrt::core::ir::get_static_params(tg->inputs(), {trt_w, trt_b}); auto trt_results_tg = torch_tensorrt::tests::util::RunGraphEngine(tg, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(trt_results_sg[0], trt_results_tg[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(trt_results_sg[0], trt_results_tg[0])); } TEST(LoweringPasses, Conv3dCorrectly) { @@ -282,7 +282,7 @@ TEST(LoweringPasses, Conv3dCorrectly) { params = torch_tensorrt::core::ir::get_static_params(tg->inputs(), {trt_w, trt_b}); auto trt_results_tg = torch_tensorrt::tests::util::RunGraphEngine(tg, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(trt_results_sg[0], trt_results_tg[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(trt_results_sg[0], trt_results_tg[0])); } TEST(LoweringPasses, ConvTransposed3dCorrectly) { @@ -337,7 +337,7 @@ TEST(LoweringPasses, ConvTransposed3dCorrectly) { params = torch_tensorrt::core::ir::get_static_params(tg->inputs(), {trt_w, trt_b}); auto trt_results_tg = torch_tensorrt::tests::util::RunGraphEngine(tg, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(trt_results_sg[0], trt_results_tg[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(trt_results_sg[0], trt_results_tg[0])); } TEST(LoweringPasses, Conv1dWithConditionalLowersCorrectly) { @@ -418,5 +418,5 @@ TEST(LoweringPasses, Conv1dWithConditionalLowersCorrectly) { params = torch_tensorrt::core::ir::get_static_params(tg->inputs(), {trt_w, trt_b}); auto trt_results_tg = torch_tensorrt::tests::util::RunGraphEngine(tg, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(trt_results_sg[0], trt_results_tg[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(trt_results_sg[0], trt_results_tg[0])); } diff --git a/tests/core/lowering/test_device_casting.cpp b/tests/core/lowering/test_device_casting.cpp index cc76f94ad6..3c0915170a 100644 --- a/tests/core/lowering/test_device_casting.cpp +++ b/tests/core/lowering/test_device_casting.cpp @@ -27,8 +27,7 @@ TEST(LoweringPasses, UnpackAndCastMaskedFillLowersCorrectly) { torch::jit::EliminateCommonSubexpression(g); auto jit_post_results = torch_tensorrt::tests::util::EvaluateGraphJIT(g, {in, in2, in3}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor(), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor())); } TEST(LoweringPasses, UnpackAndCastNumToTensorLowersIntCorrectly) { @@ -47,8 +46,7 @@ TEST(LoweringPasses, UnpackAndCastNumToTensorLowersIntCorrectly) { torch::jit::EliminateCommonSubexpression(g); auto jit_post_results = torch_tensorrt::tests::util::EvaluateGraphJIT(g, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor(), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor())); } TEST(LoweringPasses, UnpackAndCastNumToTensorLowersFloatCorrectly) { @@ -67,8 +65,7 @@ TEST(LoweringPasses, UnpackAndCastNumToTensorLowersFloatCorrectly) { torch::jit::EliminateCommonSubexpression(g); auto jit_post_results = torch_tensorrt::tests::util::EvaluateGraphJIT(g, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor(), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor())); } TEST(LoweringPasses, UnpackAndCastFullIntLowersCorrectly) { @@ -90,8 +87,8 @@ TEST(LoweringPasses, UnpackAndCastFullIntLowersCorrectly) { torch::jit::EliminateCommonSubexpression(g); auto jit_post_results = torch_tensorrt::tests::util::EvaluateGraphJIT(g, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual( - jit_pre_results[0].toTensor(), jit_post_results[0].toTensor().cpu(), 2e-6)); + ASSERT_TRUE( + torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor().cpu())); } TEST(LoweringPasses, UnpackAndCastFullFloatLowersCorrectly) { @@ -114,8 +111,8 @@ TEST(LoweringPasses, UnpackAndCastFullFloatLowersCorrectly) { torch::jit::EliminateCommonSubexpression(g); auto jit_post_results = torch_tensorrt::tests::util::EvaluateGraphJIT(g, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual( - jit_pre_results[0].toTensor(), jit_post_results[0].toTensor().cpu(), 2e-6)); + ASSERT_TRUE( + torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor().cpu())); } TEST(LoweringPasses, ReplaceScalarImplicitLowersCorrectly) { @@ -144,8 +141,7 @@ TEST(LoweringPasses, ReplaceScalarImplicitLowersCorrectly) { torch::jit::EliminateCommonSubexpression(g); auto jit_post_results = torch_tensorrt::tests::util::EvaluateGraphJIT(g, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor(), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor())); } TEST(LoweringPasses, ReplaceScalarImplicitIntNumToTensorLowersCorrectly) { @@ -167,8 +163,7 @@ TEST(LoweringPasses, ReplaceScalarImplicitIntNumToTensorLowersCorrectly) { torch::jit::EliminateCommonSubexpression(g); auto jit_post_results = torch_tensorrt::tests::util::EvaluateGraphJIT(g, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor(), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor())); } TEST(LoweringPasses, ReplaceScalarImplicitFloatLowersCorrectly) { @@ -189,6 +184,5 @@ TEST(LoweringPasses, ReplaceScalarImplicitFloatLowersCorrectly) { torch::jit::EliminateCommonSubexpression(g); auto jit_post_results = torch_tensorrt::tests::util::EvaluateGraphJIT(g, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor(), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor())); } diff --git a/tests/core/lowering/test_linear_to_addmm.cpp b/tests/core/lowering/test_linear_to_addmm.cpp index f1ff35ee31..c81bea11f4 100644 --- a/tests/core/lowering/test_linear_to_addmm.cpp +++ b/tests/core/lowering/test_linear_to_addmm.cpp @@ -93,8 +93,7 @@ TEST(LoweringPasses, LinearToAddMMBiasNoneGraphRun) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in_0, in_1}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } TEST(LoweringPasses, LinearToAddMMBiasGraphRun) { @@ -132,6 +131,5 @@ TEST(LoweringPasses, LinearToAddMMBiasGraphRun) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in_0, in_1, in_2}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } diff --git a/tests/core/lowering/test_remove_unnecessary_casts.cpp b/tests/core/lowering/test_remove_unnecessary_casts.cpp index 47a48ba82f..67daf1025f 100644 --- a/tests/core/lowering/test_remove_unnecessary_casts.cpp +++ b/tests/core/lowering/test_remove_unnecessary_casts.cpp @@ -434,8 +434,7 @@ TEST(LoweringPasses, RemoveSingleUse0DTensorsFloorDivFloatValuesAgree) { auto jit_pre_results = torch_tensorrt::tests::util::EvaluateGraphJIT(g_in, {}); auto jit_post_results = torch_tensorrt::tests::util::EvaluateGraphJIT(g_out, {}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor(), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor())); } TEST(LoweringPasses, RemoveAtenIntTensorValuesAgree) { @@ -470,8 +469,7 @@ TEST(LoweringPasses, RemoveAtenIntTensorValuesAgree) { auto jit_pre_results = torch_tensorrt::tests::util::EvaluateGraphJIT(g_in, {}); auto jit_post_results = torch_tensorrt::tests::util::EvaluateGraphJIT(g_out, {}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor(), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor())); // Ensure the lowering pass transforms the first graph into the second torch_tensorrt::core::util::logging::get_logger().set_reportable_log_level( @@ -523,8 +521,7 @@ TEST(LoweringPasses, RemoveAtenIntSizeTensorValuesAgree) { auto jit_pre_results = torch_tensorrt::tests::util::EvaluateGraphJIT(g_in, {in_0}); auto jit_post_results = torch_tensorrt::tests::util::EvaluateGraphJIT(g_out, {in_0}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor(), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor())); // Ensure the lowering pass transforms the first graph into the second torch_tensorrt::core::util::logging::get_logger().set_reportable_log_level( diff --git a/tests/core/lowering/test_replace_aten_pad_pass.cpp b/tests/core/lowering/test_replace_aten_pad_pass.cpp index a36a3dac22..7b785517d1 100644 --- a/tests/core/lowering/test_replace_aten_pad_pass.cpp +++ b/tests/core/lowering/test_replace_aten_pad_pass.cpp @@ -40,7 +40,7 @@ TEST(LoweringPasses, AtenPadConstantCorrectly) { params = torch_tensorrt::core::ir::get_static_params(tg->inputs(), {}); auto trt_results_tg = torch_tensorrt::tests::util::RunGraphEngine(tg, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(trt_results_sg[0], trt_results_tg[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(trt_results_sg[0], trt_results_tg[0])); } TEST(LoweringPasses, AtenPadConstantNoneValueCorrectly) { @@ -77,7 +77,7 @@ TEST(LoweringPasses, AtenPadConstantNoneValueCorrectly) { params = torch_tensorrt::core::ir::get_static_params(tg->inputs(), {}); auto trt_results_tg = torch_tensorrt::tests::util::RunGraphEngine(tg, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(trt_results_sg[0], trt_results_tg[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(trt_results_sg[0], trt_results_tg[0])); } TEST(LoweringPasses, AtenPadReflect1dCorrectly) { @@ -113,7 +113,7 @@ TEST(LoweringPasses, AtenPadReflect1dCorrectly) { params = torch_tensorrt::core::ir::get_static_params(tg->inputs(), {}); auto trt_results_tg = torch_tensorrt::tests::util::RunGraphEngine(tg, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(trt_results_sg[0], trt_results_tg[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(trt_results_sg[0], trt_results_tg[0])); } TEST(LoweringPasses, AtenPadReflect2dCorrectly) { @@ -149,7 +149,7 @@ TEST(LoweringPasses, AtenPadReflect2dCorrectly) { params = torch_tensorrt::core::ir::get_static_params(tg->inputs(), {}); auto trt_results_tg = torch_tensorrt::tests::util::RunGraphEngine(tg, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(trt_results_sg[0], trt_results_tg[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(trt_results_sg[0], trt_results_tg[0])); } TEST(LoweringPasses, AtenPadReplicate1dCorrectly) { @@ -185,7 +185,7 @@ TEST(LoweringPasses, AtenPadReplicate1dCorrectly) { params = torch_tensorrt::core::ir::get_static_params(tg->inputs(), {}); auto trt_results_tg = torch_tensorrt::tests::util::RunGraphEngine(tg, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(trt_results_sg[0], trt_results_tg[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(trt_results_sg[0], trt_results_tg[0])); } TEST(LoweringPasses, AtenPadReplicate2dCorrectly) { @@ -221,7 +221,7 @@ TEST(LoweringPasses, AtenPadReplicate2dCorrectly) { params = torch_tensorrt::core::ir::get_static_params(tg->inputs(), {}); auto trt_results_tg = torch_tensorrt::tests::util::RunGraphEngine(tg, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(trt_results_sg[0], trt_results_tg[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(trt_results_sg[0], trt_results_tg[0])); } TEST(LoweringPasses, AtenPadReplicate3dCorrectly) { @@ -257,5 +257,5 @@ TEST(LoweringPasses, AtenPadReplicate3dCorrectly) { params = torch_tensorrt::core::ir::get_static_params(tg->inputs(), {}); auto trt_results_tg = torch_tensorrt::tests::util::RunGraphEngine(tg, params, {trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(trt_results_sg[0], trt_results_tg[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(trt_results_sg[0], trt_results_tg[0])); } diff --git a/tests/core/lowering/test_unpack_hardsigmoid.cpp b/tests/core/lowering/test_unpack_hardsigmoid.cpp index f8206511be..72c3e08f90 100644 --- a/tests/core/lowering/test_unpack_hardsigmoid.cpp +++ b/tests/core/lowering/test_unpack_hardsigmoid.cpp @@ -43,7 +43,7 @@ TEST(LoweringPasses, UnpackHardSigmoid) { auto tg_params = torch_tensorrt::core::ir::get_static_params(tg->inputs(), {}); auto tg_results = torch_tensorrt::tests::util::RunGraph(tg, tg_params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(sg_results[0], tg_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(sg_results[0], tg_results[0])); } TEST(LoweringPasses, UnpackHardSigmoidInPlace) { @@ -83,5 +83,5 @@ TEST(LoweringPasses, UnpackHardSigmoidInPlace) { auto tg_params = torch_tensorrt::core::ir::get_static_params(tg->inputs(), {}); auto tg_results = torch_tensorrt::tests::util::RunGraph(tg, tg_params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(sg_results[0], tg_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(sg_results[0], tg_results[0])); } diff --git a/tests/core/lowering/test_unpack_hardswish.cpp b/tests/core/lowering/test_unpack_hardswish.cpp index 36dedd02f1..8d7622f68d 100644 --- a/tests/core/lowering/test_unpack_hardswish.cpp +++ b/tests/core/lowering/test_unpack_hardswish.cpp @@ -44,7 +44,7 @@ TEST(LoweringPasses, UnpackHardSwish) { auto tg_params = torch_tensorrt::core::ir::get_static_params(tg->inputs(), {}); auto tg_results = torch_tensorrt::tests::util::RunGraph(tg, tg_params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(sg_results[0], tg_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(sg_results[0], tg_results[0])); } TEST(LoweringPasses, UnpackHardInplaceSwish) { @@ -85,5 +85,5 @@ TEST(LoweringPasses, UnpackHardInplaceSwish) { auto tg_params = torch_tensorrt::core::ir::get_static_params(tg->inputs(), {}); auto tg_results = torch_tensorrt::tests::util::RunGraph(tg, tg_params, {in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(sg_results[0], tg_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(sg_results[0], tg_results[0])); } diff --git a/tests/core/lowering/test_unpack_reduce_ops.cpp b/tests/core/lowering/test_unpack_reduce_ops.cpp index 96729e4b9d..2e538268b9 100644 --- a/tests/core/lowering/test_unpack_reduce_ops.cpp +++ b/tests/core/lowering/test_unpack_reduce_ops.cpp @@ -27,8 +27,7 @@ TEST(LoweringPasses, UnpackVarLowersCorrectly) { torch::jit::EliminateCommonSubexpression(g); auto jit_post_results = torch_tensorrt::tests::util::EvaluateGraphJIT(g, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor(), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor())); } TEST(LoweringPasses, UnpackVarKeepDimsLowersCorrectly) { @@ -51,8 +50,7 @@ TEST(LoweringPasses, UnpackVarKeepDimsLowersCorrectly) { torch::jit::EliminateCommonSubexpression(g); auto jit_post_results = torch_tensorrt::tests::util::EvaluateGraphJIT(g, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor(), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor())); } TEST(LoweringPasses, UnpackVarUnbiasedLowersCorrectly) { @@ -75,8 +73,7 @@ TEST(LoweringPasses, UnpackVarUnbiasedLowersCorrectly) { torch::jit::EliminateCommonSubexpression(g); auto jit_post_results = torch_tensorrt::tests::util::EvaluateGraphJIT(g, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor(), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor())); } TEST(LoweringPasses, UnpackVarUnbiasedKeepDimsLowersCorrectly) { @@ -99,8 +96,7 @@ TEST(LoweringPasses, UnpackVarUnbiasedKeepDimsLowersCorrectly) { torch::jit::EliminateCommonSubexpression(g); auto jit_post_results = torch_tensorrt::tests::util::EvaluateGraphJIT(g, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor(), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor())); } TEST(LoweringPasses, UnpackStdLowersCorrectly) { @@ -124,8 +120,7 @@ TEST(LoweringPasses, UnpackStdLowersCorrectly) { torch::jit::EliminateCommonSubexpression(g); auto jit_post_results = torch_tensorrt::tests::util::EvaluateGraphJIT(g, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor(), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor())); } TEST(LoweringPasses, UnpackStdKeepDimsLowersCorrectly) { @@ -150,8 +145,7 @@ TEST(LoweringPasses, UnpackStdKeepDimsLowersCorrectly) { torch::jit::EliminateCommonSubexpression(g); auto jit_post_results = torch_tensorrt::tests::util::EvaluateGraphJIT(g, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor(), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor())); } TEST(LoweringPasses, UnpackStdUnbiasedLowersCorrectly) { @@ -175,8 +169,7 @@ TEST(LoweringPasses, UnpackStdUnbiasedLowersCorrectly) { torch::jit::EliminateCommonSubexpression(g); auto jit_post_results = torch_tensorrt::tests::util::EvaluateGraphJIT(g, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor(), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor())); } TEST(LoweringPasses, UnpackStdUnbiasedKeepDimsLowersCorrectly) { @@ -201,8 +194,7 @@ TEST(LoweringPasses, UnpackStdUnbiasedKeepDimsLowersCorrectly) { torch::jit::EliminateCommonSubexpression(g); auto jit_post_results = torch_tensorrt::tests::util::EvaluateGraphJIT(g, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor(), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor())); } TEST(LoweringPasses, UnpackRsqrtLowersCorrectly) { @@ -222,8 +214,7 @@ TEST(LoweringPasses, UnpackRsqrtLowersCorrectly) { torch::jit::EliminateCommonSubexpression(g); auto jit_post_results = torch_tensorrt::tests::util::EvaluateGraphJIT(g, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor(), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor())); } TEST(LoweringPasses, UnpackRsqrtIntLowersCorrectly) { @@ -243,6 +234,5 @@ TEST(LoweringPasses, UnpackRsqrtIntLowersCorrectly) { torch::jit::EliminateCommonSubexpression(g); auto jit_post_results = torch_tensorrt::tests::util::EvaluateGraphJIT(g, {in}); - ASSERT_TRUE( - torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor(), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_pre_results[0].toTensor(), jit_post_results[0].toTensor())); } diff --git a/tests/core/lowering/test_view_to_reshape_pass.cpp b/tests/core/lowering/test_view_to_reshape_pass.cpp index a6254bccde..9dfbb58ad2 100644 --- a/tests/core/lowering/test_view_to_reshape_pass.cpp +++ b/tests/core/lowering/test_view_to_reshape_pass.cpp @@ -88,5 +88,5 @@ TEST(LoweringPasses, ViewToReshapeResultsCorrectly) { auto jit_results = mod.forward({jit_in}); auto trt_results = new_mod.forward({trt_in}); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results.toTensor(), trt_results.toTensor(), 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results.toTensor(), trt_results.toTensor())); } diff --git a/tests/cpp/test_dynamic_size.cpp b/tests/cpp/test_dynamic_size.cpp index c1edff849d..90baa039c1 100644 --- a/tests/cpp/test_dynamic_size.cpp +++ b/tests/cpp/test_dynamic_size.cpp @@ -32,7 +32,7 @@ TEST(Converters, ATenResizeDynamicShapeCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenResizeDynamicInputCorrectly) { @@ -59,7 +59,7 @@ TEST(Converters, ATenResizeDynamicInputCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenResizeGetItemDynShapeCorrectly) { @@ -90,7 +90,7 @@ TEST(Converters, ATenResizeGetItemDynShapeCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenResizeGetItemDynShapeMulCorrectly) { @@ -123,7 +123,7 @@ TEST(Converters, ATenResizeGetItemDynShapeMulCorrectly) { auto trt = trt_results[0].reshape(jit_results[0].sizes()); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt, 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); } TEST(Converters, ATenUnflattenDynShapeITensorShapeCorrectly) { @@ -149,7 +149,7 @@ TEST(Converters, ATenUnflattenDynShapeITensorShapeCorrectly) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngineDynamic(g, params, {in}, true); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenUnflattenDynShapeITensorShapeCorrectlyFirstDim) { @@ -174,7 +174,7 @@ TEST(Converters, ATenUnflattenDynShapeITensorShapeCorrectlyFirstDim) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngineDynamic(g, params, {in}, true); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } TEST(Converters, ATenUnflattenDynShapeITensorShapeCorrectlyLastDim) { @@ -200,5 +200,5 @@ TEST(Converters, ATenUnflattenDynShapeITensorShapeCorrectlyLastDim) { params = torch_tensorrt::core::ir::get_static_params(g->inputs(), {}); auto trt_results = torch_tensorrt::tests::util::RunGraphEngineDynamic(g, params, {in}, true); - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } diff --git a/tests/py/dynamo/conversion/harness.py b/tests/py/dynamo/conversion/harness.py index 39a2f8ccde..6cdee663e6 100644 --- a/tests/py/dynamo/conversion/harness.py +++ b/tests/py/dynamo/conversion/harness.py @@ -254,8 +254,8 @@ def run_test( self, mod, inputs, - rtol=1e-03, - atol=1e-03, + rtol=5e-3, + atol=5e-3, precision=dtype.f32, check_dtype=True, use_dynamo_tracer=False, @@ -374,8 +374,8 @@ def run_test_with_dynamic_shape( self, mod, input_specs, - rtol=1e-03, - atol=1e-03, + rtol=5e-3, + atol=5e-3, output_dtypes=None, use_dynamo_tracer=False, enable_passes=False, diff --git a/tests/py/dynamo/conversion/test_bitwise_and_aten.py b/tests/py/dynamo/conversion/test_bitwise_and_aten.py index 8bd0415bdc..9cb63f4fdc 100644 --- a/tests/py/dynamo/conversion/test_bitwise_and_aten.py +++ b/tests/py/dynamo/conversion/test_bitwise_and_aten.py @@ -152,8 +152,8 @@ def forward(self, lhs_val, rhs_val): torch.testing.assert_close( out, ref, - rtol=0.001, - atol=0.001, + rtol=5e-3, + atol=5e-3, equal_nan=True, check_dtype=True, ) diff --git a/tests/py/dynamo/conversion/test_embedding_bag_aten.py b/tests/py/dynamo/conversion/test_embedding_bag_aten.py index 0b06e10871..03bae9b68b 100644 --- a/tests/py/dynamo/conversion/test_embedding_bag_aten.py +++ b/tests/py/dynamo/conversion/test_embedding_bag_aten.py @@ -501,8 +501,8 @@ def forward(self, weights, indices, offsets, per_sample_weights=None): torch.testing.assert_close( out, ref, - rtol=0.001, - atol=0.001, + rtol=5e-3, + atol=5e-3, equal_nan=True, check_dtype=True, ) diff --git a/tests/py/dynamo/conversion/test_index_select_aten.py b/tests/py/dynamo/conversion/test_index_select_aten.py index c5feca013e..839474a0dd 100644 --- a/tests/py/dynamo/conversion/test_index_select_aten.py +++ b/tests/py/dynamo/conversion/test_index_select_aten.py @@ -122,8 +122,8 @@ def forward(self, source_tensor, indice_tensor): torch.testing.assert_close( out, ref, - rtol=0.001, - atol=0.001, + rtol=5e-3, + atol=5e-3, equal_nan=True, check_dtype=True, ) diff --git a/tests/py/dynamo/models/test_dtype_support.py b/tests/py/dynamo/models/test_dtype_support.py index bb24c7284e..29faf4eff3 100644 --- a/tests/py/dynamo/models/test_dtype_support.py +++ b/tests/py/dynamo/models/test_dtype_support.py @@ -225,7 +225,7 @@ def forward(self, x): self.assertAlmostEqual( max_diff, 0, - DECIMALS_OF_AGREEMENT, + delta=3e-2, msg=f"Torch outputs and TRT outputs don't match close enough.", ) @@ -263,7 +263,7 @@ def forward(self, x): self.assertAlmostEqual( max_diff, 0, - DECIMALS_OF_AGREEMENT, + delta=3e-2, msg=f"Torch outputs and TRT outputs don't match close enough.", ) @@ -300,6 +300,6 @@ def forward(self, x): self.assertAlmostEqual( max_diff, 0, - DECIMALS_OF_AGREEMENT, + delta=3e-2, msg=f"Torch outputs and TRT outputs don't match close enough.", ) diff --git a/tests/util/util.cpp b/tests/util/util.cpp index 0b3e0058c9..79bb9ec1c1 100644 --- a/tests/util/util.cpp +++ b/tests/util/util.cpp @@ -112,7 +112,7 @@ void pointwise_test_helper( trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, trt_inputs); } - ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0], 2e-6)); + ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } } // namespace util diff --git a/tests/util/util.h b/tests/util/util.h index 9d3fc238d2..51ea7fef91 100644 --- a/tests/util/util.h +++ b/tests/util/util.h @@ -8,8 +8,8 @@ #include "core/util/prelude.h" #include "torch/csrc/jit/ir/irparser.h" -const float ATOL = 1e-8; -const float RTOL = 1e-5; +const float ATOL = 5e-3; +const float RTOL = 5e-3; const float COSINE_THRESHOLD = 0.99f; const float THRESHOLD_E5 = 1e-5;