From 7ea77a044ca9de9d8089bf382640fb4a7bfabc0f Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 6 Jan 2020 18:33:37 +0100 Subject: create_labels_uniform --- cli/app/search/vector.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cli/app/search') diff --git a/cli/app/search/vector.py b/cli/app/search/vector.py index 89cd949..b118ef3 100644 --- a/cli/app/search/vector.py +++ b/cli/app/search/vector.py @@ -18,3 +18,11 @@ def create_labels(batch_size, vocab_size, num_classes): label[i, j] = random.random() label[i] /= label[i].sum() return label + +def create_labels_uniform(batch_size, vocab_size): + label = np.zeros((batch_size, vocab_size)) + for i in range(batch_size): + for j in range(vocab_size): + label[i, j] = random.uniform(1 / vocab_size, 2 / vocab_size) + label[i] /= label[i].sum() + return label -- cgit v1.2.3-70-g09d2