def increment_step_counter_and_maybe_update_ensemble(self, predictions_dict, training_state):
    'Increments number of visited examples and grows the ensemble.\n\n    If the number of visited examples reaches the target examples_per_layer,\n    ensemble is updated.\n\n    Args:\n      predictions_dict: Dictionary of Rank 2 `Tensor` representing information\n          about predictions per example.\n      training_state: `dict` returned by update_stats.\n\n    Returns:\n      An op that updates the counters and potientially grows the ensemble.\n    '
    batch_size = math_ops.cast(array_ops.shape(predictions_dict[PREDICTIONS])[0], dtypes.float32)
    ensemble_stamp = predictions_dict[ENSEMBLE_STAMP]
    steps_accumulator = training_state.steps_accumulator
    num_layer_examples = training_state.num_layer_examples
    num_layer_steps = training_state.num_layer_steps
    active_layer = training_state.active_layer
    add_step_op = steps_accumulator.add(ensemble_stamp, [0], [[0, 0]], [batch_size], [1.0])
    ensemble_update_ops = [add_step_op]
    class_id = self._get_class_id(predictions_dict)
    with ops.control_dependencies([add_step_op]):
        if self._is_chief:
            dropout_seed = predictions_dict[NUM_TREES_ATTEMPTED]
            (_, _, _, _, acc_examples, acc_steps) = steps_accumulator.serialize()
            acc_examples = math_ops.cast(acc_examples[0], dtypes.int64)
            acc_steps = math_ops.cast(acc_steps[0], dtypes.int64)
            ensemble_update_ops.append(num_layer_examples.assign(acc_examples))
            ensemble_update_ops.append(num_layer_steps.assign(acc_steps))
            examples_per_layer = self._examples_per_layer
            if callable(examples_per_layer):
                examples_per_layer = examples_per_layer(active_layer)
            ensemble_update_ops.append(control_flow_ops.cond((acc_examples >= examples_per_layer), self.make_update_ensemble_fn(ensemble_stamp, training_state, dropout_seed, class_id), control_flow_ops.no_op))
    return control_flow_ops.group(*ensemble_update_ops)
Increments number of visited examples and grows the ensemble.

If the number of visited examples reaches the target examples_per_layer,
ensemble is updated.

Args:
  predictions_dict: Dictionary of Rank 2 `Tensor` representing information
      about predictions per example.
  training_state: `dict` returned by update_stats.

Returns:
  An op that updates the counters and potientially grows the ensemble.
def increment_step_counter_and_maybe_update_ensemble(self, predictions_dict, training_state):
    'Increments number of visited examples and grows the ensemble.\n\n    If the number of visited examples reaches the target examples_per_layer,\n    ensemble is updated.\n\n    Args:\n      predictions_dict: Dictionary of Rank 2 `Tensor` representing information\n          about predictions per example.\n      training_state: `dict` returned by update_stats.\n\n    Returns:\n      An op that updates the counters and potientially grows the ensemble.\n    '
    batch_size = math_ops.cast(array_ops.shape(predictions_dict[PREDICTIONS])[0], dtypes.float32)
    ensemble_stamp = predictions_dict[ENSEMBLE_STAMP]
    steps_accumulator = training_state.steps_accumulator
    num_layer_examples = training_state.num_layer_examples
    num_layer_steps = training_state.num_layer_steps
    active_layer = training_state.active_layer
    add_step_op = steps_accumulator.add(ensemble_stamp, [0], [[0, 0]], [batch_size], [1.0])
    ensemble_update_ops = [add_step_op]
    class_id = self._get_class_id(predictions_dict)
    with ops.control_dependencies([add_step_op]):
        if self._is_chief:
            dropout_seed = predictions_dict[NUM_TREES_ATTEMPTED]
            (_, _, _, _, acc_examples, acc_steps) = steps_accumulator.serialize()
            acc_examples = math_ops.cast(acc_examples[0], dtypes.int64)
            acc_steps = math_ops.cast(acc_steps[0], dtypes.int64)
            ensemble_update_ops.append(num_layer_examples.assign(acc_examples))
            ensemble_update_ops.append(num_layer_steps.assign(acc_steps))
            examples_per_layer = self._examples_per_layer
            if callable(examples_per_layer):
                examples_per_layer = examples_per_layer(active_layer)
            ensemble_update_ops.append(control_flow_ops.cond((acc_examples >= examples_per_layer), self.make_update_ensemble_fn(ensemble_stamp, training_state, dropout_seed, class_id), control_flow_ops.no_op))
    return control_flow_ops.group(*ensemble_update_ops)