class_docstr: A tree structure which has a node :class:`.Metric` and some children. Upon execution, the node is called with the
  input and its output is passed to each of the children. A dict is updated with the results.
  
  .. note::
  
     If the node output is already a dict (i.e. the node is a standalone metric), this is unwrapped before passing the
     **first** value to the children.
  
  Args:
      metric (Metric): The metric to act as the root node of the tree / subtree
class_docstr_tok: ["A","tree","structure","which","has","a","node",":","class",":","`",".Metric","`","and","some","children",".","Upon","execution",",","the","node","is","called","with","the","input","and","its","output","is","passed","to","each","of","the","children",".","A","dict","is","updated","with","the","results",".","..","note",":",":","If","the","node","output","is","already","a","dict","(","i.e",".","the","node","is","a","standalone","metric",")",",","this","is","unwrapped","before","passing","the","*","*","first","*","*","value","to","the","children",".","Args",":","metric","(","Metric",")",":","The","metric","to","act","as","the","root","node","of","the","tree","\/","subtree"]
code: def _for_tree(self, function, *args):
      result = {}
      node_value = function(self.root, *args)
      if isinstance(node_value, dict):
          node_value = next(iter(node_value.values()))
  
      for subtree in self.children:
          out = function(subtree, node_value)
          if out is not None:
              result.update(out)
  
      return result
  
imports: import inspect
  from torchbearer import Metric, no_grad
label_desc: Use image node_id 4 for calling the MetricTree obj's underlying member method code with example usage: obj._for_tree(function) and returns: result