class_docstr: Class that analyzes a graph to determine readiness of tensors.
docstr: Get the parents of the given `tensor_or_op`.
docstr_tok: ["Get","the","parents","of","the","given","`","tensor_or_op","`","."]
code: def _get_parents(self, tensor_or_op):
      """Get the parents of the given `tensor_or_op`."""
      if (
          tf_utils.hashable_tensor_or_op(tensor_or_op)
          in self._source_info_dict
      ):
          return []
  
      # func_graph_name is not None only if the graph is a FuncGraph.
      func_graph_name = getattr(self._graph, "name", None)
      if isinstance(tensor_or_op, tf.Operation):
          if tensor_or_op.type in _INITIALIZABLE_TABLE_OP_TYPES:
              raise _UnexpectedTableError(tensor_or_op, func_graph_name)
          if tensor_or_op.type == "Placeholder":
              # If we're not in the context of a tf.function, this is an error.
              if func_graph_name is None:
                  raise _UnexpectedPlaceholderError(
                      tensor_or_op, func_graph_name
                  )
              # If we're in the context of a tf.function and this op is part of its
              # inputs, that's expected.
              if tensor_or_op not in [x.op for x in self._graph.inputs]:
                  raise _UnexpectedPlaceholderError(
                      tensor_or_op, func_graph_name
                  )
          parents = list(
              itertools.chain(
                  tensor_or_op.inputs, tensor_or_op.control_inputs
              )
          )
      elif isinstance(tensor_or_op, tf.Tensor):
          parents = [tensor_or_op.op]
      else:
          raise TypeError(
              "Expected Tensor or Operation, got {} of type {}".format(
                  tensor_or_op, type(tensor_or_op)
              )
          )
      return parents
  
imports: import collections
  import copy
  import hashlib
  import itertools
  from typing import Iterable, List, Mapping, Optional, Set, Union
  import uuid
  from absl import logging
  import tensorflow
  from tensorflow_transform import analyzer_nodes
  from tensorflow_transform import common_types
  from tensorflow_transform import nodes
  from tensorflow_transform import tf_utils
  from tfx_bsl.types import tfx_namedtuple
  from tensorflow.python.framework import composite_tensor
  from tensorflow.python.framework import func_graph
  from tensorflow.python.framework import function_def_to_graph
  from tensorflow.python.util import object_identity
label_desc: Use image node_id 2 for calling the _GraphAnalyzer obj's underlying member method code with example usage: obj._get_parents(tensor_or_op) and returns: parents, list