예제 #1
0
  def __init__(self, tree_ensemble_handle, create_op, name):
    """Creates a TreeEnsembleVariableSavable object.

    Args:
      tree_ensemble_handle: handle to the tree ensemble variable.
      create_op: the op to initialize the variable.
      name: the name to save the tree ensemble variable under.
    """
    stamp_token, ensemble_config = tree_ensemble_serialize(tree_ensemble_handle)
    # slice_spec is useful for saving a slice from a variable.
    # It's not meaningful the tree ensemble variable. So we just pass an empty
    # value.
    slice_spec = ""
    specs = [
        saver.BaseSaverBuilder.SaveSpec(stamp_token, slice_spec,
                                        name + "_stamp"),
        saver.BaseSaverBuilder.SaveSpec(ensemble_config, slice_spec,
                                        name + "_config"),
    ]
    super(TreeEnsembleVariableSavable,
          self).__init__(tree_ensemble_handle, specs, name)
    self._tree_ensemble_handle = tree_ensemble_handle
    self._create_op = create_op
예제 #2
0
  def __init__(self, tree_ensemble_handle, create_op, name):
    """Creates a TreeEnsembleVariableSavable object.

    Args:
      tree_ensemble_handle: handle to the tree ensemble variable.
      create_op: the op to initialize the variable.
      name: the name to save the tree ensemble variable under.
    """
    stamp_token, ensemble_config = tree_ensemble_serialize(tree_ensemble_handle)
    # slice_spec is useful for saving a slice from a variable.
    # It's not meaningful the tree ensemble variable. So we just pass an empty
    # value.
    slice_spec = ""
    specs = [
        saver.BaseSaverBuilder.SaveSpec(stamp_token, slice_spec,
                                        name + "_stamp"),
        saver.BaseSaverBuilder.SaveSpec(ensemble_config, slice_spec,
                                        name + "_config"),
    ]
    super(TreeEnsembleVariableSavable,
          self).__init__(tree_ensemble_handle, specs, name)
    self._tree_ensemble_handle = tree_ensemble_handle
    self._create_op = create_op