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

Function af_check

src/api/c/unary.cpp:723–748  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

721
722template<af_op_t op>
723static af_err af_check(af_array *out, const af_array in) {
724 try {
725 const ArrayInfo &in_info = getInfo(in);
726
727 af_dtype in_type = in_info.getType();
728 af_array res;
729
730 // Convert all inputs to floats / doubles / complex
731 af_dtype type = implicit(in_type, f32);
732 if (in_type == f16) { type = f16; }
733 if (in_info.ndims() == 0) { return af_retain_array(out, in); }
734
735 switch (type) {
736 case f32: res = checkOp<float, op>(in); break;
737 case f64: res = checkOp<double, op>(in); break;
738 case f16: res = checkOp<half, op>(in); break;
739 case c32: res = checkOpCplx<cfloat, float, op>(in); break;
740 case c64: res = checkOpCplx<cdouble, double, op>(in); break;
741 default: TYPE_ERROR(1, in_type); break;
742 }
743
744 std::swap(*out, res);
745 }
746 CATCHALL;
747 return AF_SUCCESS;
748}
749
750#define CHECK(fn) \
751 af_err af_##fn(af_array *out, const af_array in) { \

Callers

nothing calls this directly

Calls 5

implicitFunction · 0.85
swapFunction · 0.85
af_retain_arrayFunction · 0.70
getTypeMethod · 0.45
ndimsMethod · 0.45

Tested by

no test coverage detected