| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e8561fb commit 3a081e9
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -58,6 +58,7 @@ void rreduce(Array<T> &out, Array<uint> &loc, const Array<T> &in, const int dim, | |||
| 58 | 58 | ||
| 59 | 59 | template<af_op_t op, typename T> | |
| 60 | 60 | T ireduce_all(unsigned *loc, const Array<T> &in) { | |
| 61 | + in.eval(); | ||
| 61 | 62 | getQueue().sync(); | |
| 62 | 63 | ||
| 63 | 64 | af::dim4 dims = in.dims(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -541,3 +541,15 @@ TEST(IndexedReduce, min_subarray_1) { | |||
| 541 | 541 | ASSERT_EQ(h_idx[i], gold_idx[i]); | |
| 542 | 542 | } | |
| 543 | 543 | } | |
| 544 | + | ||
| 545 | + //Ensure that array is evaluated before reducing | ||
| 546 | + TEST(IndexedReduce, reduce_jit_array) { | ||
| 547 | + af::array jit(af::dim4(2),{1.0f, 2.0f}); | ||
| 548 | + jit += af::constant(1.0f, af::dim4(2)); | ||
| 549 | + float val; unsigned idx; | ||
| 550 | + float gold_val = 2.0f; | ||
| 551 | + unsigned gold_idx = 0; | ||
| 552 | + af::min(&val, &idx, jit); | ||
| 553 | + ASSERT_EQ(val, gold_val); | ||
| 554 | + ASSERT_EQ(idx, gold_idx); | ||
| 555 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments