Skip to content

Commit

Permalink
benchdnn: rnn: fix spurious false positive failures.
Browse files Browse the repository at this point in the history
We change the data distribution in tensors to avoid accumulation
to large values in GEMM, and then overflows in exp.
  • Loading branch information
mgouicem committed Oct 24, 2018
1 parent fd77e54 commit 8560428
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/benchdnn/rnn/rnn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ int fill_memory(const rnn_prb_t *p, rnn_data_kind_t kind, dnn_mem_t &mem1,
size_t idx_end = MIN2(idx_start + chunk_size, nelems);

std::minstd_rand msr;
std::uniform_real_distribution<float> gen(-1, 1);
std::normal_distribution<float> gen(.0f, .001f);
msr.discard(idx_start);

for (size_t idx = idx_start; idx < idx_end; ++idx)
mem2.set_elem(idx, gen(msr));
for (size_t idx = idx_start; idx < idx_end; ++idx){
auto val = gen(msr);
mem2.set_elem(idx, MAX2(MIN2(val, 1.0f), -1.0f));
}
});

mem1.reorder(mem2);
Expand Down

0 comments on commit 8560428

Please sign in to comment.