def predict(self, mode):
    'Returns predictions given the features and mode.\n\n    Args:\n      mode: Mode the graph is running in (train|predict|eval).\n\n    Returns:\n      A dict of predictions tensors.\n\n    Raises:\n      ValueError: if features is not valid.\n    '
    input_deps = ((self._dense_floats + self._sparse_float_indices) + self._sparse_int_indices)
    if (not input_deps):
        raise ValueError('No input tensors for prediction.')
    ensemble_stamp = model_ops.tree_ensemble_stamp_token(self._ensemble_handle)
    if (self._ensemble_handle.device != input_deps[0].device):
        with ops.name_scope('local_ensemble', 'TreeEnsembleVariable') as name:
            local_ensemble_handle = gen_model_ops.decision_tree_ensemble_resource_handle_op(name=name)
            create_op = gen_model_ops.create_tree_ensemble_variable(local_ensemble_handle, stamp_token=(- 1), tree_ensemble_config='')
            with ops.control_dependencies([create_op]):
                local_stamp = model_ops.tree_ensemble_stamp_token(local_ensemble_handle)

        def _refresh_local_ensemble_fn():
            with ops.control_dependencies([input_deps[0]]):
                (ensemble_stamp, serialized_model) = model_ops.tree_ensemble_serialize(self._ensemble_handle)
            with ops.control_dependencies([create_op]):
                return (model_ops.tree_ensemble_deserialize(local_ensemble_handle, stamp_token=ensemble_stamp, tree_ensemble_config=serialized_model), ensemble_stamp)
        (refresh_local_ensemble, ensemble_stamp) = control_flow_ops.cond(math_ops.not_equal(ensemble_stamp, local_stamp), _refresh_local_ensemble_fn, (lambda : (control_flow_ops.no_op(), ensemble_stamp)))
        with ops.control_dependencies([refresh_local_ensemble]):
            return self._predict_and_return_dict(local_ensemble_handle, ensemble_stamp, mode)
    else:
        with ops.device(self._ensemble_handle.device):
            return self._predict_and_return_dict(self._ensemble_handle, ensemble_stamp, mode)
Returns predictions given the features and mode.

Args:
  mode: Mode the graph is running in (train|predict|eval).

Returns:
  A dict of predictions tensors.

Raises:
  ValueError: if features is not valid.
def predict(self, mode):
    'Returns predictions given the features and mode.\n\n    Args:\n      mode: Mode the graph is running in (train|predict|eval).\n\n    Returns:\n      A dict of predictions tensors.\n\n    Raises:\n      ValueError: if features is not valid.\n    '
    input_deps = ((self._dense_floats + self._sparse_float_indices) + self._sparse_int_indices)
    if (not input_deps):
        raise ValueError('No input tensors for prediction.')
    ensemble_stamp = model_ops.tree_ensemble_stamp_token(self._ensemble_handle)
    if (self._ensemble_handle.device != input_deps[0].device):
        with ops.name_scope('local_ensemble', 'TreeEnsembleVariable') as name:
            local_ensemble_handle = gen_model_ops.decision_tree_ensemble_resource_handle_op(name=name)
            create_op = gen_model_ops.create_tree_ensemble_variable(local_ensemble_handle, stamp_token=(- 1), tree_ensemble_config=)
            with ops.control_dependencies([create_op]):
                local_stamp = model_ops.tree_ensemble_stamp_token(local_ensemble_handle)

        def _refresh_local_ensemble_fn():
            with ops.control_dependencies([input_deps[0]]):
                (ensemble_stamp, serialized_model) = model_ops.tree_ensemble_serialize(self._ensemble_handle)
            with ops.control_dependencies([create_op]):
                return (model_ops.tree_ensemble_deserialize(local_ensemble_handle, stamp_token=ensemble_stamp, tree_ensemble_config=serialized_model), ensemble_stamp)
        (refresh_local_ensemble, ensemble_stamp) = control_flow_ops.cond(math_ops.not_equal(ensemble_stamp, local_stamp), _refresh_local_ensemble_fn, (lambda : (control_flow_ops.no_op(), ensemble_stamp)))
        with ops.control_dependencies([refresh_local_ensemble]):
            return self._predict_and_return_dict(local_ensemble_handle, ensemble_stamp, mode)
    else:
        with ops.device(self._ensemble_handle.device):
            return self._predict_and_return_dict(self._ensemble_handle, ensemble_stamp, mode)