From 9b180586702d1bd590347110afd2c53b281c74ed Mon Sep 17 00:00:00 2001 From: Eddie Yan Date: Tue, 26 Feb 2019 16:44:35 -0800 Subject: [PATCH 1/4] check in --- python/tvm/autotvm/util.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/python/tvm/autotvm/util.py b/python/tvm/autotvm/util.py index 2b52bfb46992..0c407e9d3671 100644 --- a/python/tvm/autotvm/util.py +++ b/python/tvm/autotvm/util.py @@ -5,6 +5,7 @@ import time import numpy as np +from random import randrange from .. import expr, ir_pass @@ -40,7 +41,7 @@ def get_rank(values): def sample_ints(low, high, m): """ Sample m different integer numbers from [low, high) without replacement - This function is an alternative of `np.random.choice` when (high - low) > 2 ^ 32, in + This function is an alternative of `np.random.choice` when (high - low) > 2 ^ 64, in which case numpy does not work. Parameters @@ -58,10 +59,11 @@ def sample_ints(low, high, m): """ vis = set() assert m <= high - low + print("hi fam") while len(vis) < m: - new = np.random.randint(low, high) + new = randrange(low, high) while new in vis: - new = np.random.randint(low, high) + new = randrange(low, high) vis.add(new) return list(vis) From b6333ac8ba38152a1e88c116b44c3032c8728e08 Mon Sep 17 00:00:00 2001 From: eqy Date: Tue, 26 Feb 2019 17:17:29 -0800 Subject: [PATCH 2/4] lint --- python/tvm/autotvm/util.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/tvm/autotvm/util.py b/python/tvm/autotvm/util.py index 0c407e9d3671..788e857b46ae 100644 --- a/python/tvm/autotvm/util.py +++ b/python/tvm/autotvm/util.py @@ -4,9 +4,10 @@ import multiprocessing import time -import numpy as np from random import randrange +import numpy as np + from .. import expr, ir_pass logger = logging.getLogger('autotvm') From d295daf34cc0db12ebb95ee9ac94d5cf603388b0 Mon Sep 17 00:00:00 2001 From: eqy Date: Tue, 26 Feb 2019 17:47:06 -0800 Subject: [PATCH 3/4] cleanup --- python/tvm/autotvm/util.py | 1 - 1 file changed, 1 deletion(-) diff --git a/python/tvm/autotvm/util.py b/python/tvm/autotvm/util.py index 788e857b46ae..81f3b79ad36b 100644 --- a/python/tvm/autotvm/util.py +++ b/python/tvm/autotvm/util.py @@ -60,7 +60,6 @@ def sample_ints(low, high, m): """ vis = set() assert m <= high - low - print("hi fam") while len(vis) < m: new = randrange(low, high) while new in vis: From bd6fe96cb7b87e94219e9605fca414ecd80ec546 Mon Sep 17 00:00:00 2001 From: eqy Date: Tue, 26 Feb 2019 17:47:24 -0800 Subject: [PATCH 4/4] Update util.py --- python/tvm/autotvm/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/tvm/autotvm/util.py b/python/tvm/autotvm/util.py index 81f3b79ad36b..528eb24be380 100644 --- a/python/tvm/autotvm/util.py +++ b/python/tvm/autotvm/util.py @@ -42,7 +42,7 @@ def get_rank(values): def sample_ints(low, high, m): """ Sample m different integer numbers from [low, high) without replacement - This function is an alternative of `np.random.choice` when (high - low) > 2 ^ 64, in + This function is an alternative of `np.random.choice` when (high - low) > 2 ^ 32, in which case numpy does not work. Parameters