docstr: Get the local tensor of this DTensor on its current rank. For sharding it returns
  a local shard of the logical tensor view, for replication it returns the replica on
  its current rank.
  
  Keyword args:
      grad_placements (List[:class:`Placement`], optional): the placements describes
          the future layout of any gradient layout of the Tensor returned from this
          function.
          `to_local` converts DTensor to local tensor and the returned local tensor
          might not be used as the original DTensor layout later in the code. This
          argument is the hint that user can give to autograd in case the gradient
          layout of the returned tensor does not match the original DTensor layout.
          If not specified, we will assume the gradient layout remains the same
          as the original DTensor and use that for gradient computation.
  
  Returns:
      A :class:`torch.Tensor` or `AsyncCollectiveTensor` object. it represents the
      local tensor on its current rank.
  
  .. note:: `to_local` is differentiable, the `requires_grad` of the local tensor returned
      will depend on if the `DTensor` requires_grad or not.
docstr_tok: ["Get","the","local","tensor","of","this","DTensor","on","its","current","rank",".","For","sharding","it","returns","a","local","shard","of","the","logical","tensor","view",",","for","replication","it","returns","the","replica","on","its","current","rank",".","Keyword","args",":","grad_placements","(","List","[",":","class",":","`","Placement","`","]",",","optional",")",":","the","placements","describes","the","future","layout","of","any","gradient","layout","of","the","Tensor","returned","from","this","function",".","`","to_local","`","converts","DTensor","to","local","tensor","and","the","returned","local","tensor","might","not","be","used","as","the","original","DTensor","layout","later","in","the","code",".","This","argument","is","the","hint","that","user","can","give","to","autograd","in","case","the","gradient","layout","of","the","returned","tensor","does","not","match","the","original","DTensor","layout",".","If","not","specified",",","we","will","assume","the","gradient","layout","remains","the","same","as","the","original","DTensor","and","use","that","for","gradient","computation",".","Returns",":","A",":","class",":","`","torch.Tensor","`","or","`","AsyncCollectiveTensor","`","object",".","it","represents","the","local","tensor","on","its","current","rank",".","..","note",":",":","`","to_local","`","is","differentiable",",","the","`","requires_grad","`","of","the","local","tensor","returned","will","depend","on","if","the","`","DTensor","`","requires_grad","or","not","."]
code: def to_local(
      self, *, grad_placements: Optional[Sequence[Placement]] = None
  ) -> torch.Tensor:
      """
      Get the local tensor of this DTensor on its current rank. For sharding it returns
      a local shard of the logical tensor view, for replication it returns the replica on
      its current rank.
  
      Keyword args:
          grad_placements (List[:class:`Placement`], optional): the placements describes
              the future layout of any gradient layout of the Tensor returned from this
              function.
              `to_local` converts DTensor to local tensor and the returned local tensor
              might not be used as the original DTensor layout later in the code. This
              argument is the hint that user can give to autograd in case the gradient
              layout of the returned tensor does not match the original DTensor layout.
              If not specified, we will assume the gradient layout remains the same
              as the original DTensor and use that for gradient computation.
  
      Returns:
          A :class:`torch.Tensor` or `AsyncCollectiveTensor` object. it represents the
          local tensor on its current rank.
  
      .. note:: `to_local` is differentiable, the `requires_grad` of the local tensor returned
          will depend on if the `DTensor` requires_grad or not.
      """
      if grad_placements is not None and not isinstance(
          grad_placements, tuple
      ):
          grad_placements = tuple(grad_placements)
      return _ToTorchTensor.apply(self, grad_placements, True)
  
imports: import warnings
  from typing import Callable, cast, Optional, Sequence, Tuple
  import torch
  import torch.distributed._functional_collectives
  import torch.distributed._tensor.dispatch
  import torch.distributed._tensor.random
  import torch.nn
  from torch.distributed._tensor._collective_utils import mesh_broadcast
  from torch.distributed._tensor._utils import compute_global_tensor_info
  from torch.distributed._tensor.placement_types import DTensorSpec, Placement, Replicate, Shard, TensorMeta
  from torch.distributed._tensor.random import is_rng_supported_mesh, OffsetBasedRNGTracker
  from torch.distributed._tensor.redistribute import Redistribute, redistribute_local_tensor
  from torch.distributed.device_mesh import _mesh_resources, DeviceMesh
label_desc: Use image node_id 7 for calling the DTensor obj's underlying member method code with example usage: obj.to_local() and returns: _ToTorchTensor