apply_cholesky_solve Class — pytorch Architecture
Architecture documentation for the apply_cholesky_solve class in BatchLinearAlgebra.cpp from the pytorch codebase.
Entity Profile
Source Code
aten/src/ATen/native/BatchLinearAlgebra.cpp lines 1699–1727
template<typename scalar_t>
static void apply_cholesky_solve(Tensor& b, Tensor& A, bool upper, Tensor& infos) {
#if !AT_BUILD_WITH_LAPACK()
TORCH_CHECK(false, "cholesky_solve: LAPACK library not found in compilation");
#else
char uplo = upper ? 'U' : 'L';
auto A_data = A.const_data_ptr<scalar_t>();
auto b_data = b.data_ptr<scalar_t>();
auto infos_data = infos.data_ptr<int>();
auto A_mat_stride = matrixStride(A);
auto b_mat_stride = matrixStride(b);
auto batch_size = batchCount(A);
auto n = A.size(-2);
auto ldab = std::max<int64_t>(1, n);
auto nrhs = b.size(-1);
for (const auto i : c10::irange(batch_size)) {
const scalar_t* A_working_ptr = &A_data[i * A_mat_stride];
scalar_t* b_working_ptr = &b_data[i * b_mat_stride];
int info = 0;
lapackCholeskySolve<scalar_t>(uplo, n, nrhs, const_cast<scalar_t*>(A_working_ptr), ldab, b_working_ptr, ldab, &info);
infos_data[i] = info;
if (info != 0) {
return;
}
}
#endif
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free