Solved by tom in post #2 
              
              
                The easiest might be to provide use torch.stack(batch_losses).mean().item() or so to make a PyTorch tensor from a list of tensors and take the mean. .item() converts to a Python number. 
Best regards 
Thomas