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

Function TEST

test/replace.cpp:115–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113TYPED_TEST(Replace, Scalar) { replaceScalarTest<TypeParam>(dim4(5, 5)); }
114
115TEST(Replace, NaN) {
116 SKIP_IF_FAST_MATH_ENABLED();
117 dim4 dims(1000, 1250);
118 dtype ty = f32;
119
120 array a = randu(dims, ty);
121 a(seq(a.dims(0) / 2), span, span, span) = NaN;
122 array c = a.copy();
123 float b = 0;
124 replace(c, !isNaN(c), b);
125
126 int num = (int)a.elements();
127
128 vector<float> ha(num);
129 vector<float> hc(num);
130
131 a.host(&ha[0]);
132 c.host(&hc[0]);
133
134 for (int i = 0; i < num; i++) {
135 ASSERT_EQ(hc[i], (std::isnan(ha[i]) ? b : ha[i]));
136 }
137}
138
139TEST(Replace, ISSUE_1249) {
140 dim4 dims(2, 3, 4);

Callers 1

replace.cppFile · 0.70

Calls 9

randuFunction · 0.85
seqClass · 0.85
isNaNFunction · 0.85
hostMethod · 0.80
replaceFunction · 0.50
isnanFunction · 0.50
dimsMethod · 0.45
copyMethod · 0.45
elementsMethod · 0.45

Tested by

no test coverage detected