Closed Adamits closed 1 month ago
What if we just use PyTorch's mean? Does that solve the problem?
Two interfaces for it:
https://pytorch.org/docs/stable/generated/torch.mean.html https://pytorch.org/docs/stable/generated/torch.Tensor.mean.html
What if we just use PyTorch's mean? Does that solve the problem?
Two interfaces for it:
https://pytorch.org/docs/stable/generated/torch.mean.html https://pytorch.org/docs/stable/generated/torch.Tensor.mean.html
Good point, thats a better solution.
Actually, the issue is that we end up with a list, not a tensor, and I think the overhead of turning the list into a tensor first is probably > the overhead of moving the values to CPU. I can test though.
Actually, the issue is that we end up with a list, not a tensor, and I think the overhead of turning the list into a tensor first is probably > the overhead of moving the values to CPU. I can test though.
yeah whatever's faster (or if they're the same pick the one that's more elegant...)
torch is a bit faster in my exps. I wonder if the fact that the scalars are already torch tensor types speeds it up?
Shall I merge?
Yes!
I guess I had not tested the final evaluators update on gpu. Since we now get the mean val loss with numpy.mean, we need to be sure the loss tensors are on cpu.