class_docstr: NestedTensor
class_docstr_tok: ["NestedTensor"]
code: def to(self, device):
      # type: (Device) -> NestedTensor # noqa
      cast_tensor = self.tensors.to(device)
      mask = self.mask
      if mask is not None:
          assert mask is not None
          cast_mask = mask.to(device)
      else:
          cast_mask = None
      return NestedTensor(cast_tensor, cast_mask)
  
file_path: towhee/towhee/models/coformer/utils.py
imports: import torch
  from torch import Tensor
  import torch.distributed
  from typing import Optional, List
label_desc: Use image node_id 2 for calling the NestedTensor obj's underlying member method code with example usage: obj.to(device) and returns: NestedTensor