[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').
This commit is contained in:
@@ -5,7 +5,7 @@ import triton
|
|||||||
|
|
||||||
def rounded_linspace(low, high, steps, div):
|
def rounded_linspace(low, high, steps, div):
|
||||||
ret = torch.linspace(low, high, steps)
|
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)
|
ret = torch.unique(ret)
|
||||||
return list(map(int, ret))
|
return list(map(int, ret))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user