MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / TEST

Function TEST

test/select.cpp:132–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130}
131
132TEST(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
155TEST(Select, ISSUE_1249) {
156 dim4 dims(2, 3, 4);

Callers 1

select.cppFile · 0.70

Calls 15

randuFunction · 0.85
seqClass · 0.85
isNaNFunction · 0.85
constantFunction · 0.85
hostMethod · 0.80
selectFunction · 0.50
isnanFunction · 0.50
evalFunction · 0.50
af_constantFunction · 0.50
af_selectFunction · 0.50
af_get_last_errorFunction · 0.50
af_free_hostFunction · 0.50

Tested by

no test coverage detected