Solved by albanD in post #3 
              
              
                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: https://pytorch.org/cppdocs/search.html?q=mean&check_keywords=yes&area=default