From a428cf0bb2b72b2cdaced264d18ca2bb36939627 Mon Sep 17 00:00:00 2001 From: Keren Zhou Date: Mon, 20 Jun 2022 20:12:09 -0700 Subject: [PATCH] [FRONTEND] Fix pytorch warning. (#560) UserWarning: __floordiv__ is deprecated, and its behavior will change in a future version of pytorch. It currently rounds toward 0 (like the 'trunc' function NOT 'floor'). This results in incorrect rounding for negative values. To keep the current behavior, use torch.div(a, b, rounding_mode='trunc'). --- python/bench/bench_matmul.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/bench/bench_matmul.py b/python/bench/bench_matmul.py index b776b3dbf..30864f391 100644 --- a/python/bench/bench_matmul.py +++ b/python/bench/bench_matmul.py @@ -5,7 +5,7 @@ import triton def rounded_linspace(low, high, steps, div): ret = torch.linspace(low, high, steps) - ret = (ret.int() + div - 1) // div * div + ret = torch.div(ret.int() + div - 1, div, rounding_mode='trunc') * div ret = torch.unique(ret) return list(map(int, ret))