uniform_kernel Class — pytorch Architecture
Architecture documentation for the uniform_kernel class in DistributionTemplates.h from the pytorch codebase.
Entity Profile
Source Code
aten/src/ATen/native/cpu/DistributionTemplates.h lines 266–277
template<typename RNG>
void uniform_kernel(TensorIteratorBase& iter, double from_, double to_, RNG generator) {
AT_DISPATCH_FLOATING_TYPES_AND2(kHalf, kBFloat16, iter.dtype(), "uniform_kernel_cpu", [&]() {
std::lock_guard<std::mutex> lock(generator->mutex_);
auto from = static_cast<scalar_t>(from_);
auto to = static_cast<scalar_t>(to_);
at::uniform_real_distribution<scalar_t> uniform(from, to);
cpu_serial_kernel(iter, [&uniform, generator]() -> scalar_t {
return static_cast<scalar_t>(uniform(generator));
});
});
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free