chainer.dataset.cached_download

chainer.dataset.cached_download(url)[source]

Downloads a file and caches it.

It downloads a file from the URL if there is no corresponding cache. After the download, this function stores a cache to the directory under the dataset root (see set_dataset_root()). If there is already a cache for the given URL, it just returns the path to the cache without downloading the same file.

Note

This function raises OSError when it fails to create the cache directory. In older version, it raised RuntimeError.

Parameters

url (str) – URL to download from.

Returns

Path to the downloaded file.

Return type

str