'Get a list of errors for backpropagating to a Tree container that has multiple output
nodes.
Arguments:
inputs (list(Tensor)): list of Tensors containing input values to be compared to
targets
targets (Tensor, list(Tensor)): either a list of Tensors containing target values, or
a single target Tensor that will be mapped to each
input
Returns:
list of Tensors containing errors for each input'

def get_errors(self, inputs, targets):

    if (type(targets) not in (tuple, list)):
        targets = ([targets] * len(self.costs))
    for (cost, i, t, we) in zip(self.costs, inputs, targets, self.weights):
        if (t is None):
            continue
        cost.get_errors(i, t)
        if isinstance(cost.deltas, list):
            for delta in cost.deltas:
                delta[:] *= we
        else:
            cost.deltas[:] *= we
    if (self.deltas is None):
        self.deltas = [c.deltas for c in self.costs]
    return self.deltas
