stack Driver

The stack driver specifies a TensorStore backed by a sequence of layered drivers, where each underlying layer describes it’s bounds via a transform.

  • The TensorStore for a stack driver has staic bounds, which may be derived from the underlying layers

  • Reading is supported if the layers TensorStore supports reading.

  • Writing is supported if the layers TensorStore supports writing.

The layers may overlap, with the subsequent layers overriding values from earlier layers in the stack.

The underlying stack TensorStore layers are opened on demand by each operation.

json driver/stack : object
  • TensorStore — Specifies a TensorStore to open/create.

Required members:
driver : "stack"
layers : array of TensorStore

Array of layered tensorstore drivers.

The stack driver maps each nested driver in layers to the position described by the layer transform. All layers must have the same dtype as well as compatible domains.

Optional members:
context : Context

Specifies context resources that augment/override the parent context.

dtype : dtype

Specifies the data type.

rank : integer[0, 32]

Specifies the rank of the TensorStore.

If transform is also specified, the input rank must match. Otherwise, the rank constraint applies to the driver directly.

transform : IndexTransform

Specifies a transform.

schema : Schema

Specifies constraints on the schema.

When opening an existing array, specifies constraints on the existing schema; opening will fail if the constraints do not match. Any soft constraints specified in the chunk_layout are ignored. When creating a new array, a suitable schema will be selected automatically based on the specified schema constraints in combination with any driver-specific constraints.

data_copy_concurrency : ContextResource = "data_copy_concurrency"

Specifies or references a previously defined Context.data_copy_concurrency. It is normally more convenient to specify a default data_copy_concurrency in the context.


  "driver": "stack",
  "layers": [ {"driver": "array", "array": [1, 2, 3], "dtype": "int32"},
      "driver": "array",
      "array": [4, 5, 6],
      "dtype": "int32",
      "transform": {
        "input_inclusive_min": 3,
        "output": {"input_dimension": 0, "offset": -3}


Example of layer driver

...     'driver':
...         'stack',
...     'layers': [
...         {
...             'driver': 'array',
...             'dtype': 'int32',
...             'array': [1, 2, 3, 4],
...         },
...         {
...             'driver': 'array',
...             'dtype': 'int32',
...             'array': [1, 2, 3, 4],
...             'transform': {
...                 'input_inclusive_min': [4],
...                 'input_exclusive_max': [8],
...                 'output': [{
...                     'input_dimension': 0,
...                     'offset': -4
...                 }]
...             },
...         },
...     ]
... }).result().schema.dtype

TensorStore Schema

Only the following TensorStore schema constraints are useful to the stack driver. They will be propagated and will cause errors when incompatible with the layer stack.

  • Schema.rank Sets the rank of the TensorStore and constrains the rank of each of the layers

  • Schema.dtype Sets the dtype of the TensorStore and constrains the dtype of each of the layers

  • Schema.domain Sets the domain of the TensorStore. The stack driver computes an effective domain as the hull of each layer’s effective domain, as derived from the layer schema and transform. For each dimension bound which is implicit and unbounded (as when the domain is omitted), the bounds for that dimension are taken from the effective domain.

  • Schema.dimension_units Sets the dimension units of the TensorStore. The stack driver will set any unset dimension units from the individual layers as long as they are in common.

Scheama options that are not allowed: