def _load_mean_std(handle):
"""
Loads mean/std values from a .t7/.npy file or returns the identity if already a numpy array.
Parameters
----------
handle : Can be either a numpy array or a filepath as string
Returns
----------
mean/std : Numpy array expressing mean/std
"""
if type(handle) == str:
if handle.endswith('.t7'):
return load_lua(handle).numpy()
elif handle.endswith('.npy'):
return np.load(handle)
else:
return torch.load(handle).numpy()
elif type(handle) == np.ndarray:
return handle
评论列表
文章目录