| 721 | |
| 722 | template<af_op_t op> |
| 723 | static 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) { \ |
nothing calls this directly
no test coverage detected