[IE Tools] Fix seed for random generator in benchmark_app(s) to have reproducable data between runs of the same application (#4757)
This commit is contained in:
@@ -168,8 +168,7 @@ void fillBlobRandom(Blob::Ptr& inputBlob,
|
||||
auto minputHolder = minput->wmap();
|
||||
|
||||
auto inputBlobData = minputHolder.as<T *>();
|
||||
std::random_device rd;
|
||||
std::mt19937 gen(rd());
|
||||
std::mt19937 gen(0);
|
||||
uniformDistribution<T2> distribution(rand_min, rand_max);
|
||||
for (size_t i = 0; i < inputBlob->size(); i++) {
|
||||
inputBlobData[i] = static_cast<T>(distribution(gen));
|
||||
|
||||
@@ -212,6 +212,7 @@ def fill_blob_with_random(layer):
|
||||
# np.random.uniform excludes high: add 1 to have it generated
|
||||
if np.dtype(dtype).kind in ['i', 'u', 'b']:
|
||||
rand_max += 1
|
||||
rs = np.random.RandomState(np.random.MT19937(np.random.SeedSequence(0)))
|
||||
if layer.shape:
|
||||
return np.random.uniform(rand_min, rand_max, layer.shape).astype(dtype)
|
||||
return (dtype)(np.random.uniform(rand_min, rand_max))
|
||||
return rs.uniform(rand_min, rand_max, layer.shape).astype(dtype)
|
||||
return (dtype)(rs.uniform(rand_min, rand_max))
|
||||
|
||||
Reference in New Issue
Block a user