code: def __new__(cls, elem, *args, **kwargs):
      # The wrapping tensor (LoggingTensor) shouldn't hold any
      # memory for the class in question, but it should still
      # advertise the same device as before
      r = torch.Tensor._make_wrapper_subclass(  # type: ignore[attr-defined]
          cls,
          elem.size(),
          strides=elem.stride(),
          storage_offset=elem.storage_offset(),
          # TODO: clone storage aliasing
          dtype=elem.dtype,
          layout=elem.layout,
          device=elem.device,
          requires_grad=kwargs.get("requires_grad", False),
      )
      # ...the real tensor is held as an element on the tensor.
      r.elem = elem.detach() if r.requires_grad else elem
      return r
  
imports: import torch
  from torch.utils._pytree import tree_map
  from typing import Iterator, List, Optional
  import logging
  import contextlib
  import itertools
  from torch.utils._python_dispatch import TorchDispatchMode
  from torch.utils.weak import WeakTensorKeyDictionary
  import functools
  from torch._C._profiler import gather_traceback, symbolize_tracebacks
label_desc: Use image node_id 1 for calling the LoggingTensor obj's underlying member method code with example usage: obj.__new__(cls, elem) and returns: r