Beispiel #1
0
  def __init__(self, params, tree_handle, stats_handle, create_op, name):
    """Creates a TreeVariableSavable object.

    Args:
      params: A TensorForestParams object.
      tree_handle: handle to the tree variable.
      stats_handle: handle to the stats variable.
      create_op: the op to initialize the variable.
      name: the name to save the tree variable under.
    """
    self.params = params
    tensor = gen_model_ops.tree_serialize(tree_handle)
    # slice_spec is useful for saving a slice from a variable.
    # It's not meaningful the tree variable. So we just pass an empty value.
    slice_spec = ""
    specs = [saver.BaseSaverBuilder.SaveSpec(tensor, slice_spec, name),]
    super(TreeVariableSavable,
          self).__init__(tree_handle, specs, name)
    self._tree_handle = tree_handle
    self._create_op = create_op
Beispiel #2
0
    def __init__(self, params, tree_handle, stats_handle, create_op, name):
        """Creates a TreeVariableSavable object.

    Args:
      params: A TensorForestParams object.
      tree_handle: handle to the tree variable.
      stats_handle: handle to the stats variable.
      create_op: the op to initialize the variable.
      name: the name to save the tree variable under.
    """
        self.params = params
        tensor = gen_model_ops.tree_serialize(tree_handle)
        # slice_spec is useful for saving a slice from a variable.
        # It's not meaningful the tree variable. So we just pass an empty value.
        slice_spec = ""
        specs = [
            saver.BaseSaverBuilder.SaveSpec(tensor, slice_spec, name),
        ]
        super(TreeVariableSavable, self).__init__(tree_handle, specs, name)
        self._tree_handle = tree_handle
        self._create_op = create_op