graphlearn_torch.utils
common
device
exit_status
- python_exit_status = False
Whether Python is shutting down. This flag is guaranteed to be set before the Python core library resources are freed, but Python may already be exiting for some time when this is set.
Hook to set this flag is _set_python_exit_flag, and is same as used in Pytorch’s dataloader: https://github.com/pytorch/pytorch/blob/f1a6f32b72b7c2b73277f89bbf7e7459a400d80a/torch/utils/data/_utils/__init__.py
mixin
- class CastMixin[source]
Bases:
objectThis class is same as PyG’s
CastMixin: https://github.com/pyg-team/pytorch_geometric/blob/master/torch_geometric/utils/mixin.py
singleton
tensor
- tensor_equal_with_device(lhs: Tensor, rhs: Tensor)[source]
Check whether the data and device of two tensors are same.
- convert_to_tensor(data: Any, dtype: dtype | None = None)[source]
Convert the input data to a tensor based type.
- apply_to_all_tensor(data: Any, tensor_method, *args, **kwargs)[source]
Apply the specified method to all tensors contained by the input data recursively.
Share memory for all tensors contained by the input data.