code: def is_tensor(x):
      # Using the built-in `isinstance` is recommended by pytorch
      # over using torch.is_tensor
      # see: https://pytorch.org/docs/stable/generated/torch.is_tensor.html
      #
      # Also, `torch.is_tensor()` causes issues with dynamo caching when
      # a torch.Tensor and numpy.ndarray of the same size, shape, and dtype
      # is passed, if called on a Tensor first the second call with ndarray
      # will return `True` and vice-versa.
      return isinstance(x, torch.Tensor)
  
imports: import contextlib
  import os
  import numpy
  import torch
  import tree
  from keras.backend.common import KerasVariable
  from keras.backend.common import global_state
  from keras.backend.common import standardize_dtype
  from keras.backend.common.dtypes import result_type
  from keras.backend.common.keras_tensor import KerasTensor
  from keras.backend.common.stateless_scope import StatelessScope
  from keras.backend.config import floatx
  from keras.utils.nest import pack_sequence_as
label_desc: Use image node_id 7 for calling a global function with example usage: is_tensor(x) and returns: isinstance