#include "tensorstore/array.h"
template <typename ElementTag,
         
 DimensionIndex Rank,
         
 ContainerKind CKind,
         
 ArrayOriginKind OriginKind>
Array<ElementTag, (Rank < 0 ? dynamic_rank(kMaxRank) : Rank)>
tensorstore::UnbroadcastArrayPreserveRank(
    
const Array<ElementTag, Rank, OriginKind, CKind>source);

Converts zero-stride dimensions (with non-zero size) to have an extent of 1, and translates the origin to 0.

Unlike UnbroadcastArray, leading singleton dimensions are retained.

If source has shared ownership of the array data, the returned array shares a reference to the data.