@@ -146,44 +146,6 @@ def normalize_chunks(chunks: Any, shape: tuple[int, ...], typesize: int) -> tupl
146146 return tuple (int (c ) for c in chunks )
147147
148148
149- def _auto_partition (
150- shape : tuple [int , ...],
151- dtype : npt .DTypeLike ,
152- shard_shape : tuple [int , ...] | Literal ["auto" ] | None ,
153- chunk_shape : tuple [int , ...] | Literal ["auto" ],
154- ) -> tuple [tuple [int , ...] | None , tuple [int , ...]]:
155- """
156- Automatically determine the shard shape and chunk shape for an array, given the shape and dtype of the array.
157- If `shard_shape` is `None` and the chunk_shape is "auto", the chunks will be set heuristically based
158- on the dtype and shape of the array.
159- If `shard_shape` is "auto", then the shard shape will be set heuristically from the dtype and shape
160- of the array; if the `chunk_shape` is also "auto", then the chunks will be set heuristically as well,
161- given the dtype and shard shape. Otherwise, the chunks will be returned as-is.
162- """
163- # no sharding
164- item_size = np .dtype (dtype ).itemsize
165- if shard_shape is None :
166- _shards_out = None
167- if chunk_shape == "auto" :
168- _chunks_out = _guess_chunks (shape , item_size )
169- else :
170- _chunks_out = chunk_shape
171- else :
172- if chunk_shape == "auto" :
173- # aim for a 1MiB chunk
174- _chunks_out = _guess_chunks (shape , item_size , max_bytes = 1024 )
175- else :
176- _chunks_out = chunk_shape
177-
178- if shard_shape == "auto" :
179- # TODO: fix me! this should be capped at some sane shard shape
180- _shards_out = tuple (c * 2 for c in _chunks_out )
181- else :
182- _shards_out = shard_shape
183-
184- return _shards_out , _chunks_out
185-
186-
187149@dataclass (frozen = True )
188150class ChunkGrid (Metadata ):
189151 @classmethod
0 commit comments