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

Function unaryOp

src/backend/cuda/unary.hpp:81–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79
80template<typename T, af_op_t op>
81Array<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
97template<typename T, af_op_t op>
98Array<char> checkOp(const Array<T> &in, dim4 outDim = dim4(-1, -1, -1, -1)) {

Callers 1

unary.hppFile · 0.50

Calls 2

dim4Class · 0.50
dimsMethod · 0.45

Tested by

no test coverage detected