def average_impurity(self):
    'Constructs a TF graph for evaluating the leaf impurity of a forest.\n\n    Returns:\n      The last op in the graph.\n    '
    impurities = []
    for i in range(self.params.num_trees):
        with ops.device(self.device_assigner.get_device(i)):
            impurities.append(self.trees[i].average_impurity())
    return math_ops.reduce_mean(array_ops.pack(impurities))
Constructs a TF graph for evaluating the leaf impurity of a forest.

Returns:
  The last op in the graph.
def average_impurity(self):
    'Constructs a TF graph for evaluating the leaf impurity of a forest.\n\n    Returns:\n      The last op in the graph.\n    '
    impurities = []
    for i in range(self.params.num_trees):
        with ops.device(self.device_assigner.get_device(i)):
            impurities.append(self.trees[i].average_impurity())
    return math_ops.reduce_mean(array_ops.pack(impurities))