-
#include "tensorstore/schema.h"
- class tensorstore::Schema;
Collection of constraints for a TensorStore schema.
When opening an existing TensorStore, specifies constraints that must be satisfied by the existing schema for the operation to succeed.
When creating a new TensorStore, the constraints are used in conjunction with any driver-dependent defaults and additional driver-specific constraints included in the spec to determine the new schema.
For interoperability with
tensorstore::Open
and other interfaces accepting a variable-length list of strongly-typed options, there is a unique wrapper type for each constraint.Constraints are set by calling
Schema::Set
. Constraints are retrieved using either the named accessor methods, likeSchema::dtype()
, or in generic code using the explicit conversion operators, e.g.static_cast<DataType>(constraints)
.Methods¶
- RankConstraint rank() const;
- explicit operator RankConstraint() const;
- absl::Status Set(RankConstraint rank);
Specifies the rank (
dynamic_rank
indicates unspecified).
- DataType dtype() const;
- explicit operator DataType() const;
- absl::Status Set(DataType value);
Specifies the data type.
- IndexDomain<> domain() const;
- explicit operator IndexDomain<>() const;
- absl::Status Set(IndexDomain<> value);
Specifies the domain.
- absl::Status Override(IndexDomain<> value);
Overrides the domain.
- ChunkLayout chunk_layout() const;
- explicit operator ChunkLayout() const;
- absl::Status Set(Option value);
Specifies the data storage layout.
- FillValue fill_value() const;
- explicit operator FillValue() const;
- absl::Status Set(FillValue value);
Specifies the fill value.
- CodecSpec codec() const;
- explicit operator CodecSpec() const;
- absl::Status Set(CodecSpec value);
Specifies the data codec.
- DimensionUnits dimension_units() const;
- absl::Status Set(DimensionUnits value);
- explicit operator DimensionUnits() const;
Specifies the physical quantity corresponding to a single index increment along each dimension.
-
absl::Status
TransformInputSpaceSchema(IndexTransformView<> transform); Transforms a
Schema
by an index transform.
Types¶
- struct Shape : public span<const Index>;
Strongly-typed alias of
span<const Index>
for representing a shape constraint.
- struct FillValue : public SharedArrayView<const void>;
Strongly-typed alias of
SharedArrayView<const void>
for representing afill_value
constraint.
- struct DimensionUnits : public span<const std::optional<Unit>>;
Strongly-typed alias of
span<const std::optional<Unit>>
for representing dimension unit constraints.
Data members¶
- static constexpr bool IsOption<T> = ChunkLayout::IsOption<T>;
Evaluates to
true
for option types compatible withSet
. Supported types are:
Friend functions¶
- friend Result<Schema> ApplyIndexTransform(Expr&& expr, Schema schema);
Transforms a
Schema
object by aDimExpression
.
Related Types¶
- class tensorstore::ChunkLayout;
Specifies a precise chunk layout or constraints on a chunk layout.
- class tensorstore::CodecSpec;
Specifies compression and other encoding/decoding parameters for a TensorStore driver.
- struct tensorstore::Unit;
Represents a physical unit, such as “nm” or “3nm” or “3 m/s”.
-
using tensorstore::DimensionUnitsVector =
std::vector<std::optional<Unit>>; Vector specifying optional units for each dimension of an index space.