- class tensorstore.Dim
1-d index interval with optionally-implicit bounds and dimension label.
Represents a contiguous range of integer index values. The inclusive lower and upper bounds may either be finite values in the closed interval \([-(2^{62}-2), +(2^{62}-2)]\), or infinite, as indicated by -/+
inf
for the lower and upper bounds, respectively.The lower and upper bounds may additionally be marked as either explicit or implicit.
The interval may also have an associated dimension label, which is primarily useful for specifying the dimensions of an
IndexDomain
.Examples
>>> ts.Dim('x') Dim(label="x") >>> ts.Dim(inclusive_min=3, exclusive_max=10, label='x') Dim(inclusive_min=3, exclusive_max=10, label="x")
See also
Constructors¶
-
Dim(label: str | None =
None
, *, implicit_lower: bool =True
, ...) Constructs an unbounded interval
(-inf, +inf)
.
-
Dim(size: int | None, label: str | None =
None
, *, ...) Constructs a sized interval
[inclusive_min, inclusive_min+size)
.
-
Dim(inclusive_min: int | None =
-inf
, ...) Constructs a half-open interval
[inclusive_min, exclusive_max)
.
-
Dim(*, inclusive_min: int | None =
-inf
, ...) Constructs a closed interval
[inclusive_min, inclusive_max]
.
Public members¶
Accessors¶
- inclusive_min : int
Inclusive lower bound of the interval.
- inclusive_max : int
Inclusive upper bound of the interval.
- exclusive_min : int
Exclusive lower bound of the interval.
- exclusive_max : int
Exclusive upper bound of the interval.
- implicit_lower : bool
Indicates if the lower bound is implicit/resizeable.
- implicit_upper : bool
Indicates if the upper bound is implicit/resizeable.
Operations¶
- __contains__(other: int) bool
Checks if the interval contains a given index.
- __contains__(inner: Dim) bool
Checks if the interval contains another interval.
- __iter__() Iterator
Enables iteration over the indices contained in the interval.
String representation¶
-
Dim(label: str | None =