easygraph.datasets.utils module#
- easygraph.datasets.utils.download(url, path=None, overwrite=True, sha1_hash=None, retries=5, verify_ssl=True, log=True)[source]#
Download a given URL.
Codes borrowed from mxnet/gluon/utils.py
- Parameters:
url (str) – URL to download.
path (str, optional) – Destination path to store downloaded file. By default stores to the current directory with the same name as in url.
overwrite (bool, optional) – Whether to overwrite the destination file if it already exists. By default always overwrites the downloaded file.
sha1_hash (str, optional) – Expected sha1 hash in hexadecimal digits. Will ignore existing file when hash is specified but doesn’t match.
retries (integer, default 5) – The number of times to attempt downloading in case of failure or non 200 return codes.
verify_ssl (bool, default True) – Verify SSL certificates.
log (bool, default True) – Whether to print the progress for download
- Returns:
The file path of the downloaded file.
- Return type:
str
- easygraph.datasets.utils.extract_archive(file, target_dir, overwrite=False)[source]#
Extract archive file.
- Parameters:
file (str) – Absolute path of the archive file.
target_dir (str) – Target directory of the archive to be uncompressed.
overwrite (bool, default True) – Whether to overwrite the contents inside the directory. By default always overwrites.
- easygraph.datasets.utils.generate_mask_tensor(mask)[source]#
Generate mask tensor according to different backend For torch, it will create a bool tensor :param mask: input mask tensor :type mask: numpy ndarray