I am quite new to PyTorch and try to build my own loss function. The key component in my model is the ability to create a
mean of losses. Specifically, suppose we have a python list of losses, each of which being a PyTorch Variable:
losses = [Variable(torch.randn(1)) for _ in xrange(5)]
Is there a way for me to create the
mean loss of this python list of losses? Note that the mean loss should also have type as
Variable as at the end I need to call backward to compute the gradient.