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

Function af_var_v2

src/api/c/var.cpp:194–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192}
193
194af_err af_var_v2(af_array* out, const af_array in, const af_var_bias bias,
195 const dim_t dim) {
196 try {
197 ARG_ASSERT(3, (dim >= 0 && dim <= 3));
198
199 af_array output = 0;
200 const ArrayInfo& info = getInfo(in);
201 af_dtype type = info.getType();
202
203 af_array no_weights = 0;
204 switch (type) {
205 case f32:
206 output = var_<float, float>(in, no_weights, bias, dim);
207 break;
208 case f64:
209 output = var_<double, double>(in, no_weights, bias, dim);
210 break;
211 case s32:
212 output = var_<int, float>(in, no_weights, bias, dim);
213 break;
214 case u32:
215 output = var_<uint, float>(in, no_weights, bias, dim);
216 break;
217 case s16:
218 output = var_<short, float>(in, no_weights, bias, dim);
219 break;
220 case u16:
221 output = var_<ushort, float>(in, no_weights, bias, dim);
222 break;
223 case s64:
224 output = var_<intl, double>(in, no_weights, bias, dim);
225 break;
226 case u64:
227 output = var_<uintl, double>(in, no_weights, bias, dim);
228 break;
229 case s8:
230 output = var_<schar, float>(in, no_weights, bias, dim);
231 break;
232 case u8:
233 output = var_<uchar, float>(in, no_weights, bias, dim);
234 break;
235 case b8:
236 output = var_<char, float>(in, no_weights, bias, dim);
237 break;
238 case c32:
239 output = var_<cfloat, cfloat>(in, no_weights, bias, dim);
240 break;
241 case c64:
242 output = var_<cdouble, cdouble>(in, no_weights, bias, dim);
243 break;
244 case f16:
245 output = var_<half, half>(in, no_weights, bias, dim);
246 break;
247 default: TYPE_ERROR(1, type);
248 }
249 std::swap(*out, output);
250 }
251 CATCHALL;

Callers 2

af_varFunction · 0.70
varFunction · 0.50

Calls 2

swapFunction · 0.85
getTypeMethod · 0.45

Tested by

no test coverage detected