GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • tensorstore
  • Tutorial
  • Indexing
  • API reference
  • C TensorStore
  • C StorageStatistics
  • M read
  • M write
  • M resize
  • M __array__
  • M resolve
  • M __setitem__(transform)
  • M __setitem__(domain)
  • M __setitem__(expr)

This view

  • Original page
  • New address

GeezerVison is showing google.github.io — tensorstore.TensorStore.__array__ - TensorStore

tensorstore.TensorStore.__array__(self, dtype: numpy.dtype | None = None, copy: bool | None = None, context: object | None = None) → numpy.ndarray

Automatic conversion to numpy.ndarray for interoperability with NumPy.

Synchronously reads from the current domain and returns the result as an array. Equivalent to self.read().result().

Examples

>>> dataset = await ts.open(
...     {
...         'driver': 'zarr',
...         'kvstore': {
...             'driver': 'memory'
...         }
...     },
...     dtype=ts.uint32,
...     shape=[70, 80],
...     create=True)
>>> dataset[10:20, 5:10] + np.array(5, dtype=np.uint32)
array([[5, 5, 5, 5, 5],
       [5, 5, 5, 5, 5],
       [5, 5, 5, 5, 5],
       [5, 5, 5, 5, 5],
       [5, 5, 5, 5, 5],
       [5, 5, 5, 5, 5],
       [5, 5, 5, 5, 5],
       [5, 5, 5, 5, 5],
       [5, 5, 5, 5, 5],
       [5, 5, 5, 5, 5]], dtype=uint32)

Warning

This reads the entire domain into memory and blocks the current thread while reading. For large arrays, it may be better to partition the domain into blocks and process each block separately.

See also

  • read

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.