code: def assert_viewless_tensor(tensor, extra_msg=None):
      """Assert that a tensor is not a view (i.e., its '._base' field is
      not set)."""
      if isinstance(tensor, list):
          [assert_viewless_tensor(t) for t in tensor]
          return tensor
      if not isinstance(tensor, torch.Tensor):
          return tensor
      assert tensor._base is None, (
          "Ensure tensor._base is None before setting tensor.data or storing "
          "tensor to memory buffer. Otherwise, a memory leak will occur (and "
          "likely accumulate over iterations). %s"
      ) % extra_msg
      return tensor
  
imports: import math
  import operator
  from functools import reduce
  import torch
  from megatron.core import parallel_state
  from megatron.core.dist_checkpointing.mapping import ShardedTensor
label_desc: Use image node_id 8 for calling a global function with example usage: assert_viewless_tensor(tensor, extra_msg) and returns: tensor, tensor, tensor