isContiguousSlice
Determines if a list of slices results in a contiguous memory access pattern.
This function analyzes slice patterns to optimize memory access and enable vectorized operations. It's particularly optimized for NCHW tensor layout commonly used in deep learning.
Contiguous Patterns (in order of efficiency):
Batch slicing:
tensor[0:k, :, :, :]- Most efficientChannel slicing:
tensor[:, 0:k, :, :]- Highly efficientSpatial region slicing:
tensor[:, :, h1:h2, w1:w2]- Good efficiencyWidth-only slicing:
tensor[:, :, :, w1:w2]- Moderate efficiency
Return
true if the slicing pattern results in contiguous memory access
Parameters
slices
the list of slice descriptors to analyze