_flatten_indices Class — pytorch Architecture
Architecture documentation for the _flatten_indices class in FlattenIndicesCommon.h from the pytorch codebase.
Entity Profile
Source Code
aten/src/ATen/native/sparse/FlattenIndicesCommon.h lines 86–101
template <template <typename func_t> class kernel_t>
Tensor _flatten_indices(const Tensor& indices, IntArrayRef size) {
TORCH_CHECK(indices.dim() > 1 && static_cast<size_t>(indices.size(0)) == size.size(),
NAME, "(): the dimensionality of sparse `indices` and the length of `size` must match. ",
"Got `indices.size(0) == ", indices.size(0), "` != `size.size() == ", size.size(), "`.");
Tensor flattened_indices;
AT_DISPATCH_INDEX_TYPES(indices.scalar_type(), NAME, [&] () {
constexpr int64_t max_sparse_dims = 8;
if (indices.size(0) <= max_sparse_dims) {
flattened_indices = _flatten_indices_impl<kernel_t, index_t, max_sparse_dims>(indices, size);
} else {
flattened_indices = _flatten_indices_impl<kernel_t, index_t>(indices, size);
}
});
return flattened_indices;
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free