Home / Class/ cpu_masked_fill_kernel Class — pytorch Architecture

cpu_masked_fill_kernel Class — pytorch Architecture

Architecture documentation for the cpu_masked_fill_kernel class in IndexKernel.cpp from the pytorch codebase.

Entity Profile

Source Code

aten/src/ATen/native/cpu/IndexKernel.cpp lines 332–346

template <typename scalar_t>
void cpu_masked_fill_kernel(TensorIterator& iter, scalar_t value) {
  auto loop = [&](char** data, const int64_t* strides, int64_t n) {
    char* dst = data[0];
    char* mask = data[1];
    for (const auto i : c10::irange(n)) {
      bool mask_value = c10::load(reinterpret_cast<bool*>(mask + strides[1] * i));

      if (mask_value) {
        *(scalar_t*)(dst + strides[0] * i) = value;
      }
    }
  };
  iter.for_each(loop);
}

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free