@@ -35,6 +35,7 @@ type error =
3535 [ `Bytes_encode_error of string
3636 | `Bytes_decode_error of string
3737 | `Sharding_shape_mismatch of int array * int array * string
38+ | Extensions .error
3839 | Array_to_array .error
3940 | Bytes_to_bytes .error ]
4041
@@ -259,21 +260,21 @@ end = struct
259260 (string , [> error ]) result
260261 = fun x t ->
261262 let open Util in
263+ let open Extensions in
262264 let open Util.Result_syntax in
263265 let shard_shape = Ndarray. shape x in
264266 let cps = Array. map2 (/ ) shard_shape t.chunk_shape in
265267 let idx_shp = Array. append cps [|2 |] in
266- let shard_idx =
267- Ndarray. create Bigarray. Int64 idx_shp Int64. max_int in
268- let sg =
269- Extensions.RegularGrid. create t.chunk_shape in
268+ let shard_idx = Ndarray. create Bigarray. Int64 idx_shp Int64. max_int in
269+ RegularGrid. create ~array_shape: shard_shape t.chunk_shape
270+ >> = fun grid ->
270271 let slice =
271272 Array. make
272273 (Ndarray. num_dims x) (Owl_types. R [] ) in
273274 let coords = Indexing. coords_of_slice slice shard_shape in
274275 let tbl = Arraytbl. create @@ Array. length coords in
275276 Ndarray. iteri (fun i y ->
276- let k, c = Extensions. RegularGrid. index_coord_pair sg coords.(i) in
277+ let k, c = RegularGrid. index_coord_pair grid coords.(i) in
277278 Arraytbl. add tbl k (c, y)) x;
278279 let fill_value =
279280 Arraytbl. to_seq_values tbl
@@ -378,7 +379,8 @@ end = struct
378379 if Ndarray. for_all (Int64. equal Int64. max_int) shard_idx then
379380 Ok (Ndarray. create repr.kind repr.shape repr.fill_value)
380381 else
381- let sg = RegularGrid. create t.chunk_shape in
382+ RegularGrid. create ~array_shape: repr.shape t.chunk_shape
383+ >> = fun sg ->
382384 let slice =
383385 Array. make
384386 (Array. length repr.shape)
@@ -416,10 +418,10 @@ end = struct
416418 inner.kind (Array. of_list res) repr.shape
417419
418420 let rec chain_to_yojson chain =
419- [ % to_yojson: Yojson.Safe. t list ] @@
420- List. map ArrayToArray. to_yojson chain.a2a @
421- (ArrayToBytes. to_yojson chain.a2b) ::
422- List. map BytesToBytes. to_yojson chain.b2b
421+ `List
422+ ( List. map ArrayToArray. to_yojson chain.a2a @
423+ (ArrayToBytes. to_yojson chain.a2b) ::
424+ List. map BytesToBytes. to_yojson chain.b2b)
423425
424426 and to_yojson t =
425427 let codecs = chain_to_yojson t.codecs
0 commit comments