| 51 | |
| 52 | template<typename T, af_op_t op> |
| 53 | static inline af_array arithOp(const af_array lhs, const af_array rhs, |
| 54 | const dim4 &odims) { |
| 55 | const ArrayInfo &linfo = getInfo(lhs); |
| 56 | const ArrayInfo &rinfo = getInfo(rhs); |
| 57 | |
| 58 | dtype type = static_cast<af::dtype>(af::dtype_traits<T>::af_type); |
| 59 | |
| 60 | const detail::Array<T> &l = |
| 61 | linfo.getType() == type ? getArray<T>(lhs) : castArray<T>(lhs); |
| 62 | const detail::Array<T> &r = |
| 63 | rinfo.getType() == type ? getArray<T>(rhs) : castArray<T>(rhs); |
| 64 | |
| 65 | return getHandle(arithOp<T, op>(l, r, odims)); |
| 66 | } |
| 67 | |
| 68 | template<typename T, af_op_t op> |
| 69 | static inline af_array arithOpBroadcast(const af_array lhs, |