Load `.npy` file. Parameters ------------ path : str Path to the file (optional). name : str File name. Examples --------- - see tl.files.save_any_to_npy()
(path='', name='file.npy')
| 2268 | |
| 2269 | |
| 2270 | def load_npy_to_any(path='', name='file.npy'): |
| 2271 | """Load `.npy` file. |
| 2272 | |
| 2273 | Parameters |
| 2274 | ------------ |
| 2275 | path : str |
| 2276 | Path to the file (optional). |
| 2277 | name : str |
| 2278 | File name. |
| 2279 | |
| 2280 | Examples |
| 2281 | --------- |
| 2282 | - see tl.files.save_any_to_npy() |
| 2283 | |
| 2284 | """ |
| 2285 | file_path = os.path.join(path, name) |
| 2286 | try: |
| 2287 | return np.load(file_path, allow_pickle=True).item() |
| 2288 | except Exception: |
| 2289 | return np.load(file_path, allow_pickle=True) |
| 2290 | raise Exception("[!] Fail to load %s" % file_path) |
| 2291 | |
| 2292 | |
| 2293 | def file_exists(filepath): |
nothing calls this directly
no test coverage detected
searching dependent graphs…