code: def is_ref(x):
      """Evaluates if the object has reference semantics.
  
      An object is deemed "reference" if it is a `tf.Variable` instance or is
      derived from a `tf.Module` with `dtype` and `shape` properties.
  
      Args:
        x: Any object.
  
      Returns:
        is_ref: Python `bool` indicating input is has nonreference semantics, i.e.,
          is a `tf.Variable` or a `tf.Module` with `dtype` and `shape` properties.
      """
      # TODO(b/134430874): Consider making this recurse through nests, e.g.,
      # `tensor_util.is_ref([tf.Variable(0.), np.array(1.)])`
      # returns True. Note: we'd need to actually create a tf.Module on user's
      # behalf and it would need a `dtype` and `shape`. (I.e., there would be some
      # work to support this.)
      return is_variable(x) or (
          is_module(x) and hasattr(x, "dtype") and hasattr(x, "shape")
      )
  
file_path: probability/tensorflow_probability/python/internal/tensor_util.py
imports: import tensorflow.compat.v2
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
label_desc: Use image node_id 3 for calling a global function with example usage: is_ref(x) and returns: unknown