Yes. you are on the right track.
You register a buffer with self.register_buffer for your running mean, and then you will take the mean of your input batch via: batch_mean = input.data.mean(...).
Please note the part input.data, which will give you direct access to the Tensor backing the input Variable.