class_docstr: A wrapping tensor that hacks ``torch.autograd`` without patching more ``torch.ops.aten`` ops.
  `device` is the device that ``MetaTensor`` is supposed to run on. Meta tensors give you the
  ability to run PyTorch code without having to actually do computation through tensors
  allocated on a `meta` device. Because the device is `meta`, meta tensors do not model
  device propagation. ``MetaTensor`` extends its usage by carrying an additional `device`
  which tracks devices that would have been used.
  
  Reference:
      https://github.com/pytorch/pytorch/blob/master/torch/_subclasses/fake_tensor.py
class_docstr_tok: ["A","wrapping","tensor","that","hacks","``","torch.autograd","``","without","patching","more","``","torch.ops.aten","``","ops",".","`","device","`","is","the","device","that","``","MetaTensor","``","is","supposed","to","run","on",".","Meta","tensors","give","you","the","ability","to","run","PyTorch","code","without","having","to","actually","do","computation","through","tensors","allocated","on","a","`","meta","`","device",".","Because","the","device","is","`","meta","`",",","meta","tensors","do","not","model","device","propagation",".","``","MetaTensor","``","extends","its","usage","by","carrying","an","additional","`","device","`","which","tracks","devices","that","would","have","been","used",".","Reference",":","https",":","\/\/github.com\/pytorch\/pytorch\/blob\/master\/torch\/_subclasses\/fake_tensor.py"]
docstr: An extension of `torch.Tensor.to()` to MetaTensor
  Returns:
      result (MetaTensor): MetaTensor
  Usage:
      >>> tensor = MetaTensor(torch.rand(10), device='cuda:100')
      >>> tensor.to(torch.uint8)
      MetaTensor(tensor(..., device='meta', size=(10,), dtype=torch.uint8), device='cuda:100')
      >>> tensor.to(torch.device('cuda:42'))
      MetaTensor(tensor(..., device='meta', size=(10,)), device='cuda:42')
      >>> tensor.to('vulkan')
      MetaTensor(tensor(..., device='meta', size=(10,)), device='vulkan')
docstr_tok: ["An","extension","of","`","torch.Tensor.to","(",")","`","to","MetaTensor","Returns",":","result","(","MetaTensor",")",":","MetaTensor","Usage",":",">",">",">","tensor","=","MetaTensor","(","torch.rand","(","10",")",",","device='cuda:100","'",")",">",">",">","tensor.to","(","torch.uint8",")","MetaTensor","(","tensor","(","...",",","device='meta","'",",","size=","(","10",",",")",",","dtype=torch.uint8",")",",","device='cuda:100","'",")",">",">",">","tensor.to","(","torch.device","(","'cuda:42","'",")",")","MetaTensor","(","tensor","(","...",",","device='meta","'",",","size=","(","10",",",")",")",",","device='cuda:42","'",")",">",">",">","tensor.to","(","'vulkan","'",")","MetaTensor","(","tensor","(","...",",","device='meta","'",",","size=","(","10",",",")",")",",","device='vulkan","'",")"]
code: def to(self, *args, **kwargs) -> torch.Tensor:
      """An extension of `torch.Tensor.to()` to MetaTensor
      Returns:
          result (MetaTensor): MetaTensor
      Usage:
          >>> tensor = MetaTensor(torch.rand(10), device='cuda:100')
          >>> tensor.to(torch.uint8)
          MetaTensor(tensor(..., device='meta', size=(10,), dtype=torch.uint8), device='cuda:100')
          >>> tensor.to(torch.device('cuda:42'))
          MetaTensor(tensor(..., device='meta', size=(10,)), device='cuda:42')
          >>> tensor.to('vulkan')
          MetaTensor(tensor(..., device='meta', size=(10,)), device='vulkan')
      """
      # this imitates c++ function in the way of @overload
      device = None
  
      def replace(x):
          nonlocal device
          if isinstance(x, str) or isinstance(x, _device):
              device = x
              return torch.device("meta")
          return x
  
      elem = self._tensor.to(
          *tree_map(replace, args), **tree_map(replace, kwargs)
      )
      return MetaTensor(elem, device=device)
  
imports: import uuid
  from functools import partial
  import torch
  import torch.distributed
  from torch.types import _device
  from torch.utils._pytree import tree_map
  from ._monkey_patch import _AliasATen, _DistCommMethod, _InplaceATen, _MaybeInplaceATen, _TorchOverrideableFactoryMethod
label_desc: Use image node_id 4 for calling the MetaTensor obj's underlying member method code with example usage: obj.to() and returns: MetaTensor, x, torch