code: def _type(self, dtype=None, non_blocking=False, **kwargs):
      """Returns the type if `dtype` is not provided, else casts this object to
      the specified type.
  
      If this is already of the correct type, no copy is performed and the
      original object is returned.
  
      Args:
          dtype (type or string): The desired type
          non_blocking (bool): If ``True``, and the source is in pinned memory
              and destination is on the GPU or vice versa, the copy is performed
              asynchronously with respect to the host. Otherwise, the argument
              has no effect.
          **kwargs: For compatibility, may contain the key ``async`` in place of
              the ``non_blocking`` argument. The ``async`` arg is deprecated.
      """
      non_blocking = _get_async_or_non_blocking(
          "type", non_blocking, kwargs
      )
      if dtype is None:
          return self.__module__ + "." + self.__class__.__name__
  
      if isinstance(dtype, str):
          dtype = _import_dotted_name(dtype)
      if dtype == type(self):
          return self
      if self.is_sparse:
          if not dtype.is_sparse:
              raise RuntimeError(
                  "Cannot cast sparse tensor to dense tensor"
              )
          new_module_name = dtype.__module__.replace(".sparse", "")
          new_values_type_name = new_module_name + "." + dtype.__name__
          new_values = torch.Tensor._values(self).type(
              new_values_type_name, non_blocking
          )
          new_indices_type_name = new_module_name + ".LongTensor"
          new_indices = torch.Tensor._indices(self).type(
              new_indices_type_name, non_blocking
          )
          return dtype(new_indices, new_values, self.size())
      if dtype.is_sparse:
          raise RuntimeError(
              "Cannot cast dense tensor to sparse tensor"
          )
      return dtype(self.size()).copy_(self, non_blocking)
  
imports: import copyreg
  import functools
  import sys
  import traceback
  import warnings
  from collections import defaultdict
  from typing import Any, DefaultDict, List, Optional
  import torch
label_desc: Use image node_id 1 for calling a global function with example usage: _type(dtype, non_blocking) and returns: dtype, unknown, self, dtype