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.
docstr: Init method for _OptimizeVisitor.
  
  Args:
    dataset_keys: An iterable of strings which are keys for a partitioned
      dataset.
    cache_dict: A dictionary of input cache that can be used in place of a
      cacheable accumulate operation. A dictionary from dataset_keys to
      dictionaries of cache keys to PCollections. This can be None if there is
      no cache.
    tensor_keys_to_paths: A dictionary from a tensor key to a unique TF graph
      path hash.
    cache_output_nodes: A dictionary from (dataset_key, cache_key) to encoded
      cache ValueNode. This is the output cache for this graph.
    num_phases: The number of phases of analysis.
docstr_tok: ["Init","method","for","_OptimizeVisitor",".","Args",":","dataset_keys",":","An","iterable","of","strings","which","are","keys","for","a","partitioned","dataset",".","cache_dict",":","A","dictionary","of","input","cache","that","can","be","used","in","place","of","a","cacheable","accumulate","operation",".","A","dictionary","from","dataset_keys","to","dictionaries","of","cache","keys","to","PCollections",".","This","can","be","None","if","there","is","no","cache",".","tensor_keys_to_paths",":","A","dictionary","from","a","tensor","key","to","a","unique","TF","graph","path","hash",".","cache_output_nodes",":","A","dictionary","from","(","dataset_key",",","cache_key",")","to","encoded","cache","ValueNode",".","This","is","the","output","cache","for","this","graph",".","num_phases",":","The","number","of","phases","of","analysis","."]
code: def __init__(
      self,
      dataset_keys: Collection[analyzer_cache.DatasetKey],
      cache_dict: Optional[analyzer_cache.BeamAnalysisCache],
      tensor_keys_to_paths: Mapping[str, str],
      cache_output_nodes: _IntermediateCacheType,
      num_phases: int,
  ):
      """Init method for _OptimizeVisitor.
  
      Args:
        dataset_keys: An iterable of strings which are keys for a partitioned
          dataset.
        cache_dict: A dictionary of input cache that can be used in place of a
          cacheable accumulate operation. A dictionary from dataset_keys to
          dictionaries of cache keys to PCollections. This can be None if there is
          no cache.
        tensor_keys_to_paths: A dictionary from a tensor key to a unique TF graph
          path hash.
        cache_output_nodes: A dictionary from (dataset_key, cache_key) to encoded
          cache ValueNode. This is the output cache for this graph.
        num_phases: The number of phases of analysis.
      """
      self._sorted_dataset_keys = sorted(dataset_keys)
      self._cache_dict = cache_dict
      self._tensor_keys_to_paths = tensor_keys_to_paths
      self._dataset_has_cache_misses = collections.defaultdict(bool)
      self._num_encode_cache_nodes = 0
      self._num_decode_cache_nodes = 0
      self.cache_output_nodes = cache_output_nodes
      self._num_phases = num_phases
  
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 1 to create a new _OptimizeVisitor object from inherited base classes: nodes with example: obj = _OptimizeVisitor(dataset_keys, cache_dict, tensor_keys_to_paths, cache_output_nodes, num_phases)