Skip to content

Commit 3017a39

Browse files
committed
chore: Increase threshold for topk
Signed-off-by: Dheeraj Peri <[email protected]>
1 parent 789be61 commit 3017a39

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

tests/core/conversion/converters/test_topk.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ TEST(Converters, ATenTopKConvertsCorrectly) {
2626
auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in});
2727

2828
ASSERT_TRUE(
29-
torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6));
29+
torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 8e-5));
3030
ASSERT_TRUE(
31-
torch_tensorrt::tests::util::almostEqual(jit_results[1], trt_results[1].reshape_as(jit_results[1]), 2e-6));
31+
torch_tensorrt::tests::util::almostEqual(jit_results[1], trt_results[1].reshape_as(jit_results[1]), 8e-5));
3232
}

tests/util/util.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ bool cosineSimEqual(const at::Tensor& computed_tensor, const at::Tensor& gt_tens
1111
computed_tensor.flatten(), gt_tensor.flatten(), torch::nn::functional::CosineSimilarityFuncOptions().dim(0));
1212
std::ostringstream ss;
1313
ss << computed_tensor << std::endl << gt_tensor << std::endl;
14-
LOG_GRAPH(ss.str());
15-
LOG_GRAPH(std::string("Cosine Similarity score: ") + std::to_string(cosine_sim.item<float>()));
16-
LOG_GRAPH(std::string("Acceptable Threshold: ") + std::to_string(threshold));
14+
LOG_DEBUG(ss.str());
15+
LOG_DEBUG(std::string("Cosine Similarity score: ") + std::to_string(cosine_sim.item<float>()));
16+
LOG_DEBUG(std::string("Acceptable Threshold: ") + std::to_string(threshold));
1717

1818
return cosine_sim.item<float>() >= threshold;
1919
}
@@ -31,14 +31,14 @@ bool almostEqual(const at::Tensor& computed_tensor, const at::Tensor& gt_tensor,
3131
auto result = diff.abs().max().item<float>();
3232
auto threshold = atol + (rtol * gt_tensor.abs().max().item<float>());
3333

34-
LOG_GRAPH(std::string("Max Difference: ") + std::to_string(result));
35-
LOG_GRAPH(std::string("Acceptable Threshold: ") + std::to_string(threshold));
34+
LOG_DEBUG(std::string("Max Difference: ") + std::to_string(result));
35+
LOG_DEBUG(std::string("Acceptable Threshold: ") + std::to_string(threshold));
3636

3737
return result <= threshold;
3838
}
3939

4040
bool exactlyEqual(const at::Tensor& computed_tensor, const at::Tensor& gt_tensor) {
41-
LOG_GRAPH(computed_tensor << std::endl << gt_tensor << std::endl);
41+
LOG_DEBUG(computed_tensor << std::endl << gt_tensor << std::endl);
4242
std::cout << "Max Difference: " << (computed_tensor - gt_tensor).abs().max().item<float>() << std::endl;
4343

4444
return (computed_tensor - gt_tensor).abs().max().item<float>() == 0.f;

0 commit comments

Comments
 (0)