From 6bb22e0fb984ebfe7ed6d267c93b5220fe072653 Mon Sep 17 00:00:00 2001 From: Arda Coskunses Date: Wed, 21 Aug 2024 16:45:59 -0700 Subject: [PATCH] Remove redundant torch.abs in sim check Summary: The absolute value is redundant because the next step involves squaring the differences, which makes all values non-negative. X-link: https://github.com/pytorch/FBGEMM/pull/2822 Pulled By: spcyppt X-link: https://github.com/facebookresearch/FBGEMM/pull/109 spcyppt Reviewed By: q10 Differential Revision: D61492832 fbshipit-source-id: 9208ba1c6c572b500e4e2c505ec6fc8a93a01c77 --- fbgemm_gpu/experimental/gen_ai/bench/quantize_bench.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fbgemm_gpu/experimental/gen_ai/bench/quantize_bench.py b/fbgemm_gpu/experimental/gen_ai/bench/quantize_bench.py index b2b8d0eb7..57d95ad5d 100644 --- a/fbgemm_gpu/experimental/gen_ai/bench/quantize_bench.py +++ b/fbgemm_gpu/experimental/gen_ai/bench/quantize_bench.py @@ -82,7 +82,7 @@ def benchmark( # Compute the output given quantized values. output = quantize_op.compute(*quantized_vals) # Compare the quantize op output to reference as a sanity check. - sim_check = torch.mean(torch.pow(torch.abs(output - out_ref), 2)) + sim_check = torch.mean(torch.pow(output - out_ref, 2)) # Now perform benchmark. if bench_quantize: