pub(crate) mod helpers;
pub(crate) mod shape_ops;
pub(crate) mod statistics_common;
mod allocator;
mod graph;
#[cfg(feature = "sparse")]
pub(crate) mod sparse_utils;
#[cfg(any(feature = "cuda", feature = "wgpu"))]
pub(crate) use allocator::AllocGuard;
pub(crate) use allocator::DefaultAllocator;
pub use allocator::{AllocationStats, Allocator, TrackingAllocator};
pub use graph::{Graph, NoOpGraph};
pub(crate) use helpers::{
compute_broadcast_shape, ensure_contiguous, normalize_dim, validate_arange,
validate_binary_dtypes, validate_eye,
};
#[cfg(any(feature = "cuda", feature = "wgpu"))]
#[inline]
pub(crate) fn compute_contiguous_strides(shape: &[usize]) -> Vec<usize> {
if shape.is_empty() {
return Vec::new();
}
let mut strides = vec![1usize; shape.len()];
for i in (0..shape.len().saturating_sub(1)).rev() {
strides[i] = strides[i + 1] * shape[i + 1];
}
strides
}