compare_base_kernel Class — pytorch Architecture
Architecture documentation for the compare_base_kernel class in TensorCompareKernel.cpp from the pytorch codebase.
Entity Profile
Source Code
aten/src/ATen/native/cpu/TensorCompareKernel.cpp lines 74–100
template <typename scalar_t, typename scalar_t_2=int64_t, typename func_t>
inline void compare_base_kernel(const Tensor& result1, const Tensor& result2,
const Tensor& self,
int64_t dim,
bool keepdim,
const func_t& f) {
auto self_dim_stride = ensure_nonempty_stride(self, dim);
auto loop = [&](char** data, const int64_t* strides, int64_t n) {
auto* result1_data_bytes = data[0];
auto* result2_data_bytes = data[1];
const auto* self_data_bytes = data[2];
for ([[maybe_unused]] const auto i : c10::irange(n)) {
f((scalar_t*)result1_data_bytes,
(scalar_t_2*)result2_data_bytes,
(scalar_t*)self_data_bytes,
self_dim_stride);
result1_data_bytes += strides[0];
result2_data_bytes += strides[1];
self_data_bytes += strides[2];
}
};
compare_base_kernel_core<scalar_t, scalar_t_2>(
result1, result2, self, dim, keepdim, loop);
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free