code: def set_device_and_dtype(
      model: Any,
      batches: List[torch.Tensor],
      device: Union[str, torch.device],
      dtype: torch.dtype,
  ) -> Tuple[Any, List[torch.Tensor]]:
      """Set the device and dtype of a model and its batches
  
      >>> import torch
      >>> from torch import nn
      >>> from doctr.models.utils import set_device_and_dtype
      >>> model = nn.Sequential(nn.Linear(8, 8), nn.ReLU(), nn.Linear(8, 4))
      >>> batches = [torch.rand(8) for _ in range(2)]
      >>> model, batches = set_device_and_dtype(model, batches, device="cuda", dtype=torch.float16)
  
      Args:
      ----
          model: the model to be set
          batches: the batches to be set
          device: the device to be used
          dtype: the dtype to be used
  
      Returns:
      -------
          the model and batches set
      """
      return model.to(device=device, dtype=dtype), [
          batch.to(device=device, dtype=dtype) for batch in batches
      ]
  
file_path: doctr/doctr/models/utils/pytorch.py
imports: import logging
  from typing import Any, List, Optional, Tuple, Union
  import torch
  from torch import nn
  from doctr.utils.data import download_from_url
label_desc: Use image node_id 5 for calling a global function with example usage: set_device_and_dtype(model, batches, device, dtype) and returns: model,  unknown