'Compute the cost function over a list of inputs and targets.
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:
Tensor containing cost'

def get_cost(self, inputs, targets):

    if (not isinstance(inputs, list)):
        return self.costs[0].get_cost(inputs, targets)
    else:
        if (type(targets) not in (tuple, list)):
            targets = ([targets] * len(self.costs))
        costs = []
        for (w, c, i, t) in zip(self.weights, self.costs, inputs, targets):
            if (t is not None):
                costs.append((w * c.get_cost(i, t)))
        return reduce(add, costs)
