How to compute Pytorch C++ Tensor mean?

Hi everyone,

I’ve taken a look around but haven’t been able to find an answer.
Is there an equivalent to Python’s torch.mean() in C++?

Thank you for your help.

Note that if you have a pytorch Tensor on your cpp side, at::mean(t, dim) will work .
You can find these in the cpp API doc:


Hey @albanD,

Thank you very much!
It works just as you stated :smile: