API reference¶
Core¶
- classtensorstore.TensorStore
Asynchronous multi-dimensional array handle.
- classtensorstore.Context
Manages shared TensorStorecontext resources, such as caches and credentials.
- classtensorstore.KvStore
Key-value store that maps an ordered set of byte string keys to byte string values.
- classtensorstore.Transaction
Transactions are used to stage a group of modifications (e.g. writes to
tensorstore.TensorStoreobjects) in memory, and then either commit thegroup all at once or abort it.
- classtensorstore.Batch
Batches are used to group together read operations for potentially improvedefficiency.
- tensorstore.open(spec:Spec|Any,*,...)→Future[TensorStore]
Opens or creates a
TensorStorefrom aSpec.
Indexing¶
- tensorstore.inf:int=
4611686018427387903 Special constant equal to\(2^{62}-1\) that indicates an unboundedindex domain.
- classtensorstore.IndexDomain
Domain (including bounds and optional dimension labels) of an N-dimensionalindex space.
- classtensorstore.IndexTransform
Represents a transform from an input index space to an output space.
- classtensorstore.Dim
1-d index interval with optionally-implicit bounds and dimension label.
- classtensorstore.OutputIndexMap
Represents an output index map for an index transform.
- classtensorstore.OutputIndexMaps
View of the output index maps for an index transform.
- classtensorstore.OutputIndexMethod
Indicates theoutput index method of an
OutputIndexMap.
- classtensorstore.DimExpression
Specifies an advanced indexing operation.
- classtensorstore.DimSelection(DimExpression)
Specifies a dimension selection, for starting adimension expression.
- statictensorstore.d[selection:DimSelectionLike]→DimSelection
Constructs a
DimSelectionfrom a sequence of dimension indices, ranges, and/or labels.
- tensorstore.newaxis=
None Alias for
Noneused inindexing expressions to specify a new singleton dimension.
- classtensorstore.Indexable
Abstract base class for types that supportTensorStore indexing operations.
- tensorstore.NumpyIndexTerm
Individual term in a
NumpyIndexingSpec.
- tensorstore.NumpyIndexingSpec
NumPy-style indexing expression.
- tensorstore.DimSelectionLike
Subsequence of dimensions to select in a
DimSelectionobject.
Spec¶
- classtensorstore.Spec
Specification for opening or creating a
TensorStore.
- classtensorstore.Schema
Driver-independent options for defining a TensorStore schema.
- classtensorstore.CodecSpec
Specifies driver-specific encoding/decoding parameters.
- classtensorstore.OpenMode
Specifies the mode to use when opening a
TensorStore.
- classtensorstore.ChunkLayout
Describes the storage layout of a
tensorstore.TensorStore.
- classtensorstore.Unit
Specifies a physical quantity/unit.
- tensorstore.RecheckCacheOption
Determines under what circumstances cached data is revalidated.
Views¶
- tensorstore.DownsampleMethod
Downsampling method for use by thedownsample driver.
- tensorstore.cast(base:TensorStore,dtype:DTypeLike)→TensorStore
Returns a read/write view with the data type converted.
- tensorstore.array(array:ArrayLike,...)→TensorStore
Returns a TensorStore that reads/writes from an in-memory array.
- tensorstore.overlay(layers,...)→TensorStore
Virtually overlays a sequence of
TensorStorelayers within a common domain.
- tensorstore.stack(layers,...)→TensorStore
Virtually stacks a sequence of
TensorStorelayers along a new dimension.
- tensorstore.concat(layers,...)→TensorStore
Virtually concatenates a sequence of
TensorStorelayers along an existing dimension.
- tensorstore.downsample(base:TensorStore,...)→TensorStore
Returns a virtualdownsampled view of a
TensorStore.
- tensorstore.downsample(base:Spec,downsample_factors,...)→Spec
Returns a virtualdownsampled view view of a
Spec.
Virtual views¶
- classtensorstore.VirtualChunkedReadParameters
Options passed to read callbacks used with
virtual_chunked.
- classtensorstore.VirtualChunkedWriteParameters
Options passed to write callbacks used with
virtual_chunked.
- tensorstore.virtual_chunked(...)→TensorStore
Creates a
TensorStorewhere the content is read/written chunk-wise by an arbitrary function.
Data types¶
- classtensorstore.dtype
TensorStore data type representation.
- tensorstore.bool:dtype=
dtype("bool") Boolean data type (0 or 1). Corresponds to the
booltype andnumpy.bool_.
- tensorstore.int2:dtype=
dtype("int2") 2-bit signedtwo’s-complement integer data type, internally stored as its 8-bit signed integer equivalent (i.e. sign-extended). Corresponds to
jax.numpy.int2.
- tensorstore.int4:dtype=
dtype("int4") 4-bit signedtwo’s-complement integer data type, internally stored as its 8-bit signed integer equivalent (i.e. sign-extended). Corresponds to
jax.numpy.int4.
- tensorstore.int8:dtype=
dtype("int8") 8-bit signedtwo’s-complement integer data type. Corresponds to
numpy.int8.
- tensorstore.int16:dtype=
dtype("int16") 16-bit signedtwo’s-complement integer data type. Corresponds to
numpy.int16.
- tensorstore.int32:dtype=
dtype("int32") 32-bit signedtwo’s-complement integer data type. Corresponds to
numpy.int32.
- tensorstore.int64:dtype=
dtype("int64") 32-bit signedtwo’s-complement integer data type. Corresponds to
numpy.int64.
- tensorstore.uint64:dtype=
dtype("uint64") 64-bit unsigned integer data type. Corresponds to
numpy.uint64.
- tensorstore.float8_e3m4:dtype=
dtype("float8_e3m4") 8-bit floating-point data type.
- tensorstore.float8_e4m3fn:dtype=
dtype("float8_e4m3fn") 8-bit floating-point data type.
- tensorstore.float8_e4m3fnuz:dtype=
dtype("float8_e4m3fnuz") 8-bit floating-point data type.
- tensorstore.float8_e4m3b11fnuz:dtype=
dtype("float8_e4m3b11fnuz") 8-bit floating-point data type.
- tensorstore.float8_e5m2:dtype=
dtype("float8_e5m2") 8-bit floating-point data type.
- tensorstore.float8_e5m2fnuz:dtype=
dtype("float8_e5m2fnuz") 8-bit floating-point data type.
- tensorstore.float16:dtype=
dtype("float16") IEEE 754 binary16 half-precision floating-point data type. Correspond to
numpy.float16.
- tensorstore.bfloat16:dtype=
dtype("bfloat16") bfloat16 floating-point data type.
- tensorstore.float32:dtype=
dtype("float32") IEEE 754 binary32 single-precision floating-point data type. Corresponds to
numpy.float32.
- tensorstore.float64:dtype=
dtype("float64") IEEE 754 binary64 double-precision floating-point data type. Corresponds to
numpy.float64.
- tensorstore.complex64:dtype=
dtype("complex64") Complex number based on
float32. Corresponds tonumpy.complex64.
- tensorstore.complex128:dtype=
dtype("complex128") Complex number based on
float64. Corresponds tonumpy.complex128.
- tensorstore.string:dtype=
dtype("string") Variable-length byte string data type. Corresponds to the Python
bytestype.
- tensorstore.ustring:dtype=
dtype("ustring") Variable-length Unicode string data type. Corresponds to the Python
strtype.
Asynchronous support¶
- classtensorstore.WriteFutures
Handle for consuming the result of an asynchronous write operation.
- tensorstore.FutureLike
Generic type representing a possibly-asynchronous result.
OCDBT¶
- classtensorstore.ocdbt.DistributedCoordinatorServer
Distributed coordinator server for the OCDBT (Optionally-Cooperative DistributedB+Tree) database.
- tensorstore.ocdbt.dump(base:KvStore,...)→Future[Any]
Dumps the internal representation of an OCDBT database.
Experimental¶
- tensorstore.experimental_collect_matching_metrics(...)→list[Any]
Collects metrics with a matching prefix.
- tensorstore.experimental_collect_prometheus_format_metrics(...)→list[str]
Collects metrics in prometheus exposition format.See:https://prometheus.io/docs/instrumenting/exposition_formats/
- tensorstore.experimental_push_metrics_to_prometheus(...)→Future[int]
Publishes metrics to the prometheus pushgateway.See:https://github.com/prometheus/pushgateway
- tensorstore.experimental_update_verbose_logging(...)→None
Updates verbose logging flags associated with –tensorstore_verbose_logging andTENSORSTORE_VERBOSE_LOGGING flags.
- tensorstore.parse_tensorstore_flags(argv:list[str])→None
Parses and initializes internal tensorstore flags from argv.