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

Function mean_first

src/backend/oneapi/kernel/mean.hpp:520–548  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

518
519template<typename Ti, typename Tw, typename To>
520void mean_first(Param<To> out, Param<Ti> in, Param<Tw> iwt) {
521 uint threads_x = nextpow2(std::max(32u, (uint)in.info.dims[0]));
522 threads_x = std::min(threads_x, THREADS_PER_BLOCK);
523 uint threads_y = THREADS_PER_BLOCK / threads_x;
524
525 uint blocks_x = divup(in.info.dims[0], threads_x * REPEAT);
526 uint blocks_y = divup(in.info.dims[1], threads_y);
527
528 Array<To> tmpOut = createEmptyArray<To>(dim4());
529 Array<Tw> tmpWt = createEmptyArray<Tw>(dim4());
530 if (blocks_x > 1) {
531 tmpOut = createEmptyArray<To>(
532 {blocks_x, in.info.dims[1], in.info.dims[2], in.info.dims[3]});
533 tmpWt = createEmptyArray<Tw>(
534 {blocks_x, in.info.dims[1], in.info.dims[2], in.info.dims[3]});
535 } else {
536 tmpOut = createParamArray(out, false);
537 }
538
539 mean_first_launcher<Ti, Tw, To>(tmpOut, tmpWt, in, iwt, blocks_x, blocks_y,
540 threads_x);
541
542 if (blocks_x > 1) {
543 Param<Tw> owt;
544 owt.data = nullptr;
545 mean_first_launcher<To, Tw, To>(out, owt, tmpOut, tmpWt, 1, blocks_y,
546 threads_x);
547 }
548}
549
550template<typename Ti, typename Tw, typename To>
551void mean_weighted(Param<To> out, Param<Ti> in, Param<Tw> iwt, int dim) {

Callers

nothing calls this directly

Calls 5

nextpow2Function · 0.85
maxFunction · 0.50
minFunction · 0.50
dim4Class · 0.50
createParamArrayFunction · 0.50

Tested by

no test coverage detected