You didn’t say GPU. The direct correspondence for mean(…, out=) is mean_out, maybe that is the easiest. The k = 0 probably needs to be a _degs.new_zeros({1}).
If you want to go beyond what you have, you probably need to write your own kernel.
If you want your own kernels, there are PackedTensorAccessors, but you probably need the fixes from the native batch norm PR 2, too. Or you can do the pointers yourself, as in the C++ extension example 40’s cuda part.
Best regards
Thomas
P.S.: I forgot in my last mail, you likely want torch::Tensor, not at::Tensor.