MolecularDiffusion.utils.torch¶
Attributes¶
Functions¶
|
|
|
|
|
Concatenate a list of nested containers with the same structure. |
|
Clone tensors in any nested conatiner. |
|
Transfer any nested container of tensors to CPU. |
|
Transfer any nested container of tensors to CUDA. |
|
Detach tensors in any nested conatiner. |
|
Compute mean of tensors in any nested container. |
|
Recursively assigns a given device to all submodules of a torch.nn.Module. |
|
Sets seed for reproducibility across torch, numpy, and random modules. |
|
Stack a list of nested containers with the same structure. |
Module Contents¶
- MolecularDiffusion.utils.torch.adjust_bias(param, new_shape)¶
- MolecularDiffusion.utils.torch.adjust_weights(param, new_shape)¶
- MolecularDiffusion.utils.torch.cat(objs, *args, **kwargs)¶
Concatenate a list of nested containers with the same structure.
- MolecularDiffusion.utils.torch.clone(obj, *args, **kwargs)¶
Clone tensors in any nested conatiner.
- MolecularDiffusion.utils.torch.cpu(obj, *args, **kwargs)¶
Transfer any nested container of tensors to CPU.
- MolecularDiffusion.utils.torch.cuda(obj, *args, **kwargs)¶
Transfer any nested container of tensors to CUDA.
- MolecularDiffusion.utils.torch.detach(obj)¶
Detach tensors in any nested conatiner.
- MolecularDiffusion.utils.torch.get_vram_size()¶
- MolecularDiffusion.utils.torch.mean(obj, *args, **kwargs)¶
Compute mean of tensors in any nested container.
- MolecularDiffusion.utils.torch.recursive_module_to_device(module: torch.nn.Module, device: torch.device)¶
Recursively assigns a given device to all submodules of a torch.nn.Module.
- Parameters:
module (nn.Module) – The main module to which the device needs to be assigned.
device (torch.device) – The target device (e.g., torch.device(‘cuda’) or torch.device(‘cpu’)).
- MolecularDiffusion.utils.torch.seed_everything(seed: int = None, workers: bool = False, verbose: bool = True) int¶
Sets seed for reproducibility across torch, numpy, and random modules.
- MolecularDiffusion.utils.torch.stack(objs, *args, **kwargs)¶
Stack a list of nested containers with the same structure.
- MolecularDiffusion.utils.torch.MAX_SEED_VALUE = 4294967295¶
- MolecularDiffusion.utils.torch.MIN_SEED_VALUE = 0¶