load_blosc2#
- deepinv.utils.load_blosc2(fname, as_memmap=False, dtype=np.float32, **kwargs)[source]#
Load volume from blosc2 file as torch tensor.
- Parameters:
fname (str, pathlib.Path) – file to load.
as_memmap (bool,) – open this file as a memory-mapped array (which does not load the entire array into memory). This is useful when extracting patches from large arrays or to quickly infer dtype and shape.
dtype (numpy.dtype, str) – data type to use when loading the blosc2 file. This is ignored if
as_memmapisTrue.
- Returns:
torch.Tensorcontaining loaded numpy array. Ifas_memmapisTrue, returns a blosc2 array object instead.- Return type:
torch.Tensor | blosc2.ndarray.NDArray