Commit ddc31fd4 by eqy Committed by Lianmin Zheng

[AUTOTVM] tweak `sample_int` implementation (#2677)

* check in

* lint

* cleanup

* Update util.py
parent bd780795
...@@ -4,6 +4,8 @@ import logging ...@@ -4,6 +4,8 @@ import logging
import multiprocessing import multiprocessing
import time import time
from random import randrange
import numpy as np import numpy as np
from .. import expr, ir_pass from .. import expr, ir_pass
...@@ -59,9 +61,9 @@ def sample_ints(low, high, m): ...@@ -59,9 +61,9 @@ def sample_ints(low, high, m):
vis = set() vis = set()
assert m <= high - low assert m <= high - low
while len(vis) < m: while len(vis) < m:
new = np.random.randint(low, high) new = randrange(low, high)
while new in vis: while new in vis:
new = np.random.randint(low, high) new = randrange(low, high)
vis.add(new) vis.add(new)
return list(vis) return list(vis)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment