Exemplo n.º 1
0
 def __init__(self, combiner, serialized_tf_config):
   if isinstance(combiner, analyzers.QuantilesCombiner):
     tf_config = common._maybe_deserialize_tf_config(  # pylint: disable=protected-access
         serialized_tf_config)
     combiner.initialize_local_state(tf_config)
   self._combiner = combiner
   self._serialized_tf_config = serialized_tf_config
Exemplo n.º 2
0
  def __init__(self,
               combiner,
               serialized_tf_config,
               is_combining_accumulators,
               should_extract_output=None):
    """Init method for _CombinerWrapper.

    Args:
      combiner: A `analyzer_nodes.Combiner` object used to combine.
      serialized_tf_config: A str which is a serialized form of
        `tf.ConfigProto`.
      is_combining_accumulators: A bool which indicates whether this is
        combining single or batched inputs, or already accumulated objects.
      should_extract_output: A bool which indicates whether this should call the
        combiner's extract_output method in extract_output. If not specified, we
        assume it's the same value as `should_extract_output`.
    """
    # TODO(b/69566045): Move initialization to start_bundle(), removing the need
    # for initialize_local_state to be called here.
    if isinstance(combiner, analyzers.QuantilesCombiner):
      tf_config = common._maybe_deserialize_tf_config(  # pylint: disable=protected-access
          serialized_tf_config)
      combiner.initialize_local_state(tf_config)
    self._combiner = combiner
    self._serialized_tf_config = serialized_tf_config
    self._is_combining_accumulators = is_combining_accumulators
    if should_extract_output is None:
      should_extract_output = is_combining_accumulators
    self._should_extract_output = should_extract_output
Exemplo n.º 3
0
 def _make_graph_state(self, saved_model_dir):
   start = datetime.datetime.now()
   tf_config = common._maybe_deserialize_tf_config(  # pylint: disable=protected-access
       self._serialized_tf_config)
   result = self._GraphState(saved_model_dir, self._input_schema,
                             self._exclude_outputs, tf_config)
   self._graph_load_seconds_distribution.update(
       int((datetime.datetime.now() - start).total_seconds()))
   return result
Exemplo n.º 4
0
 def __init__(self, spec, serialized_tf_config):
     if isinstance(spec, analyzers._QuantilesCombinerSpec):  # pylint: disable=protected-access
         spec.initialize_local_state(
             common._maybe_deserialize_tf_config(serialized_tf_config))  # pylint: disable=protected-access
     self._spec = spec
     self._serialized_tf_config = serialized_tf_config