- towhee.trainer.utils.trainer_utils.send_to_device(tensor: Any, device: device)¶
Recursively sends the elements in a nested list/tuple/dictionary of tensors to a given device. Borrowed from huggingface/accelerate. :param tensor: The data to send to a given device. :type tensor: nested list/tuple/dictionary of
torch.Tensor:param device: The device to send the data to :type device:
The same data structure as
tensorwith all tensors sent to the proper device.