| 130 | } |
| 131 | |
| 132 | TEST(Select, NaN) { |
| 133 | SKIP_IF_FAST_MATH_ENABLED(); |
| 134 | dim4 dims(1000, 1250); |
| 135 | dtype ty = f32; |
| 136 | |
| 137 | array a = randu(dims, ty); |
| 138 | a(seq(a.dims(0) / 2), span, span, span) = NaN; |
| 139 | float b = 0; |
| 140 | array c = select(isNaN(a), b, a); |
| 141 | |
| 142 | int num = (int)a.elements(); |
| 143 | |
| 144 | vector<float> ha(num); |
| 145 | vector<float> hc(num); |
| 146 | |
| 147 | a.host(&ha[0]); |
| 148 | c.host(&hc[0]); |
| 149 | |
| 150 | for (int i = 0; i < num; i++) { |
| 151 | ASSERT_FLOAT_EQ(hc[i], std::isnan(ha[i]) ? b : ha[i]); |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | TEST(Select, ISSUE_1249) { |
| 156 | dim4 dims(2, 3, 4); |
no test coverage detected