#include "tensorstore/rank.h"
using tensorstore::InlineRank = DimensionIndex;

Specifies a fixed compile-time rank, or a run-time rank with an optional inline storage limit.

  • Non-negative integers 0, 1, …, kMaxRank indicate a fixed rank specified at compile time.

  • A value of dynamic_rank(k) (equal to -k -1), for 0 <= k <= kMaxRank, indicates that the rank is determined at run time, and bounds/layout information for rank values up to k will be stored inline without additional heap allocation.

  • The special value dynamic_rank, equivalent to dynamic_rank(0), indicates that the rank is determined at run time, and any non-zero rank will require heap-allocated storage of bounds/layout information.

constexpr bool tensorstore::IsValidInlineRank(InlineRank inline_rank);

Checks if inline_rank is a valid compile-time rank constraint.

constexpr DimensionIndex
tensorstore::InlineRankLimit(InlineRank rank_spec);

Returns the inline rank limit of a rank spec.