class_docstr: Visitor optimizes the operation graph (see nodes.py).
  
  This operates on the translated graph which is emitted by the
  `_TranslateVisitor`, and performs optimizations.
  
  Namely, when enabled, this enables reading and writing from/to analyzer
  accumulator cache to avoid recomputing them over already seen datasets.
  This type of optimization requires also creating a partitioned view of the
  input data, according to the `is_partitionable` annotation.
code: def _validate_operation_def(self, operation_def):
      if operation_def.cache_coder is not None:
          if not operation_def.is_partitionable:
              raise ValueError(
                  "Non partitionable OperationDefs cannot be cacheable: "
                  f"{operation_def.label}"
              )
      if (
          operation_def.is_partitionable
          or operation_def.cache_coder is not None
      ):
          if operation_def.num_outputs != 1:
              raise ValueError(
                  "Cacheable OperationDefs must have exactly 1 output: "
                  f"{operation_def.label}"
              )
  
imports: import collections
  import dataclasses
  import hashlib
  from typing import Collection, Dict, Mapping, Optional, Tuple
  from typing import OrderedDict
  import tensorflow
  from tensorflow_transform import analyzer_nodes
  from tensorflow_transform import common_types
  from tensorflow_transform import graph_tools
  from tensorflow_transform import impl_helper
  from tensorflow_transform import nodes
  from tensorflow_transform import tf2_utils
  from tensorflow_transform import tf_utils
  from tensorflow_transform.beam import analyzer_cache
  from tensorflow_transform.beam import beam_nodes
  from tensorflow_transform.beam import combiner_packing_util
label_desc: Use image node_id 2 for calling the _OptimizeVisitor obj's underlying member method code with example usage: obj._validate_operation_def(operation_def) without return types