def record_stream(self, stream):
        """Record stream that is using the storage.
        Does nothing if the backend is not PyTorch.

        Parameters
        ----------
        stream : torch.cuda.Stream.
        """
        if F.get_preferred_backend() != "pytorch":
            raise DGLError("record_stream only supports the PyTorch backend.")
        if self.index is not None and (
            isinstance(self.index, _LazyIndex)
            or F.context(self.index) != F.cpu()
        ):
            self.index.record_stream(stream)
        if F.context(self.storage) != F.cpu():
            self.storage.record_stream(stream)
Record stream that is using the storage.
        Does nothing if the backend is not PyTorch.

        Parameters
        ----------
        stream : torch.cuda.Stream.
        
python/dgl/frame.py