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_memmap is True.

Returns:

torch.Tensor containing loaded numpy array. If as_memmap is True, returns a blosc2 array object instead.

Return type:

torch.Tensor | blosc2.ndarray.NDArray