scal Class — pytorch Architecture
Architecture documentation for the scal class in BlasKernel.cpp from the pytorch codebase.
Entity Profile
Source Code
aten/src/ATen/native/BlasKernel.cpp lines 520–539
template <typename scalar_t>
static inline void scal(int64_t n, scalar_t a, scalar_t *x, int64_t incx)
{
if (n == 1) incx = 1;
#if AT_BUILD_WITH_BLAS()
if (blas_impl::scal_use_fast_path<scalar_t>(n, incx)) {
int i_n = static_cast<int>(n);
int i_incx = static_cast<int>(incx);
blas_impl::scal_fast_path<scalar_t>(&i_n, &a, x, &i_incx);
return;
}
#endif
for (const auto i : c10::irange(n)) {
if (a == scalar_t(0)) {
x[i * incx] = 0;
} else {
x[i * incx] *= a;
}
}
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free