code: def isscalar(val):
      """Returns whether `val` is a scalar value or scalar Tensor."""
      if isinstance(val, np_arrays.ndarray):
          val = val.data
      if isinstance(val, core.Tensor):
          ndims = val.shape.ndims
          if ndims is not None:
              return ndims == 0
          else:
              return math_ops.equal(array_ops.rank(val), 0)
      else:
          return np.isscalar(val)
  
imports: import inspect
  import numbers
  import os
  import re
  import numpy
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import flexible_dtypes
  from tensorflow.python.framework import indexed_slices
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import cond
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops.numpy_ops import np_arrays
  from tensorflow.python.ops.numpy_ops import np_dtypes
  from tensorflow.python.types import core
  from tensorflow.python.util import nest
  from tensorflow.python.util import tf_export
label_desc: Use image node_id 6 for calling a global function with example usage: isscalar(val) and returns: np, unknown, math_ops