Solved by albanD in post #2 
              
              
                Hi, 
You can just initialize it with a python 0. 
I haven’t run it, but the following code should work  
def calc_loss(Y_pred, Y_true, criteria, lambdas):
    #  Y_pred: the output from the network
    #  Y_true: the target values
    #  criteria: an iterable of pytorch loss criteria, e.g. [torch.nn…