-
#include "tensorstore/strided_layout.h"
-
template <typename LayoutOrder,
DimensionIndex Rank,
ArrayOriginKind OriginKind>
requires IsContiguousLayoutOrder<LayoutOrder, Rank>
void tensorstore::InitializeContiguousLayout(
LayoutOrder order,
Index element_stride,
std::type_identity_t<
span<const Index, RankConstraint::FromInlineRank(Rank)>>
shape,
StridedLayout<Rank, OriginKind>* layout); Initializes
*layout
to a contiguous layout with the specifiedshape
.- Parameters:¶
- LayoutOrder order¶
The layout order to use.
- Index element_stride¶
The byte stride for the last dimension if
order == c_order
, or for the first dimension iforder == fortran_order
. Typically this is equal to the size of the data type. Ifspan(shape).size() == 0
, this has no effect.- std::type_identity_t<span<const Index, RankConstraint::FromInlineRank(Rank)>> shape¶
The shape to assign to
*layout
. Must be aspan
with a static extent compatible withRank
and aspan::value_type
convertible without narrowing toIndex
.- out
- StridedLayout<Rank, OriginKind> *layout¶
Layout to update. The rank will be set to
std::size(shape)
, and any existing value is ignored.