| 79 | |
| 80 | template<typename T, af_op_t op> |
| 81 | Array<T> unaryOp(const Array<T> &in, dim4 outDim = dim4(-1, -1, -1, -1)) { |
| 82 | using arrayfire::common::Node; |
| 83 | using arrayfire::common::Node_ptr; |
| 84 | using std::array; |
| 85 | |
| 86 | auto createUnary = [](array<Node_ptr, 1> &operands) { |
| 87 | return common::Node_ptr(new common::UnaryNode( |
| 88 | static_cast<af::dtype>(af::dtype_traits<T>::af_type), |
| 89 | unaryName<op>(), operands[0], op)); |
| 90 | }; |
| 91 | |
| 92 | if (outDim == dim4(-1, -1, -1, -1)) { outDim = in.dims(); } |
| 93 | Node_ptr out = common::createNaryNode<T, 1>(outDim, createUnary, {&in}); |
| 94 | return createNodeArray<T>(outDim, out); |
| 95 | } |
| 96 | |
| 97 | template<typename T, af_op_t op> |
| 98 | Array<char> checkOp(const Array<T> &in, dim4 outDim = dim4(-1, -1, -1, -1)) { |