scale_ Class — pytorch Architecture
Architecture documentation for the scale_ class in BlasKernel.cpp from the pytorch codebase.
Entity Profile
Source Code
aten/src/ATen/native/cpu/BlasKernel.cpp lines 57–77
template <typename scalar_t, typename opmath_t>
void scale_(int64_t m, int64_t n, opmath_t alpha, scalar_t *a, int64_t lda) {
if (alpha == opmath_t(1)) {
return; // identity
}
if (alpha == opmath_t(0)) {
for (const auto j : c10::irange(n)) {
for (const auto i : c10::irange(m)) {
a[j * lda + i] = scalar_t(0);
}
}
return;
}
for (const auto j : c10::irange(n)) {
for (const auto i : c10::irange(m)) {
a[j * lda + i] *= alpha;
}
}
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free