utils¶
-
cogdl.utils.utils.
alias_draw
(J, q)[source]¶ Draw sample from a non-uniform discrete distribution using alias sampling.
-
cogdl.utils.utils.
alias_setup
(probs)[source]¶ Compute utility lists for non-uniform sampling from discrete distributions. Refer to https://hips.seas.harvard.edu/blog/2013/03/03/the-alias-method-efficient-sampling-with-many-discrete-outcomes/ for details
-
cogdl.utils.utils.
download_url
(url, folder, name=None, log=True)[source]¶ Downloads the content of an URL to a specific folder.
-
cogdl.utils.utils.
get_memory_usage
(print_info=False)[source]¶ Get accurate gpu memory usage by querying torch runtime
-
cogdl.utils.utils.
get_norm_layer
(norm: str, channels: int)[source]¶ - Args:
- norm: str
- type of normalization: layernorm, batchnorm, instancenorm
- channels: int
- size of features for normalization
-
cogdl.utils.utils.
untar
(path, fname, deleteTar=True)[source]¶ Unpacks the given archive file to the same directory, then (by default) deletes the archive file.