load_np#
- deepinv.utils.load_np(fname, as_memmap=False, dtype=np.float32, **kwargs)[source]#
Load numpy array from file as torch tensor.
- Parameters:
fname (str, pathlib.Path) – file to load.
as_memmap (bool,) – open this file as a memmap, 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 numpy array. This is ignored if
as_memmapisTrue.
- Returns:
torch.Tensorcontaining loaded numpy array. Ifas_memmapisTrue, returns a numpymemmapobject instead.- Return type: