Home

strideB

StrideB is a term used in computer science to denote the memory distance between consecutive elements along the B dimension in a multi-dimensional array when stored in linear memory. In a three-dimensional array with axes A, B, and C stored in row-major (C-order) layout, the memory address of element (a, b, c) is base + ((a * B) + b) * C + c, all multiplied by the element size. From this, the typical strides are StrideA = B * C, StrideB = C, and StrideC = 1. StrideB thus represents how many contiguous data units you must skip to move from one B-indexed element to the next while keeping A constant and varying C.

In general, for a tensor with shape [D0, D1, D2, ..., Dn-1] stored in C-order, the stride for

Usage and implications: StrideB is important for indexing, pointer arithmetic, and performance. Access patterns that use

Note: StrideB is not a universal standard term; in many contexts, strides are described as a vector

axis
i
equals
the
product
of
the
sizes
of
all
later
axes.
StrideB
corresponds
to
the
product
of
the
dimensions
to
the
right
of
B.
If
the
array
is
transposed,
sliced
with
a
step,
or
otherwise
reorganized,
StrideB
may
differ
from
its
contiguous-default
value,
reflecting
a
non-contiguous
memory
layout.
unit
strides
(where
successive
B
elements
are
adjacent
in
memory)
enable
vectorization
and
cache-friendly
memory
access.
Frameworks
and
languages
expose
strides
as
properties
of
arrays
or
tensors,
and
compilers
optimize
code
based
on
actual
stride
information
to
maximize
throughput.
for
all
axes.
StrideB
is
a
shorthand
emphasis
used
when
discussing
memory
layout
with
respect
to
the
B
dimension.