_compute_contiguous Class — pytorch Architecture
Architecture documentation for the _compute_contiguous class in Contiguity.h from the pytorch codebase.
Entity Profile
Source Code
c10/core/Contiguity.h lines 13–33
template <typename T>
bool _compute_contiguous(ArrayRef<T> sizes, ArrayRef<T> strides, T numel) {
if (numel == 0) {
return true;
}
T expected_stride = 1;
// NB: make sure we do signed arithmetic
for (int64_t d = int64_t(sizes.size()) - 1; d >= 0; d--) {
const auto& size_d = sizes[d];
if (size_d == 1) {
continue;
}
if (strides[d] != expected_stride) {
return false;
}
expected_stride *= size_d;
}
return true;
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free