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

Function identity

src/backend/opencl/kernel/identity.hpp:30–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28
29template<typename T>
30static void identity(Param out) {
31 std::array<TemplateArg, 1> targs = {
32 TemplateTypename<T>(),
33 };
34 std::array<std::string, 4> options = {
35 DefineKeyValue(T, dtype_traits<T>::getName()),
36 DefineKeyValue(ONE, scalar_to_option(scalar<T>(1))),
37 DefineKeyValue(ZERO, scalar_to_option(scalar<T>(0))),
38 getTypeBuildDefinition<T>()};
39
40 auto identityOp = common::getKernel("identity_kernel", {{identity_cl_src}},
41 targs, options);
42
43 cl::NDRange local(32, 8);
44 int groups_x = divup(out.info.dims[0], local[0]);
45 int groups_y = divup(out.info.dims[1], local[1]);
46 cl::NDRange global(groups_x * out.info.dims[2] * local[0],
47 groups_y * out.info.dims[3] * local[1]);
48
49 identityOp(cl::EnqueueArgs(getQueue(), global, local), *(out.data),
50 out.info, groups_x, groups_y);
51 CL_DEBUG_FINISH(getQueue());
52}
53
54} // namespace kernel
55} // namespace opencl

Callers

nothing calls this directly

Calls 5

getNameFunction · 0.85
EnqueueArgsClass · 0.85
scalar_to_optionFunction · 0.50
getKernelFunction · 0.50
getQueueFunction · 0.50

Tested by

no test coverage detected