Here is a small code snippet calculating the mean for each sample in the batch:
N, C, H, W = 10, 3, 24, 24
x = torch.randn(N, C, H, W)
x_mean = x.view(N, -1).mean(1, keepdim=True)
x_norm = x / x_mean[:, :, None, None]

I’m not sure, if the last line is achieving, what you are trying to do.
Each point would be divided by the mean of the sample not its sum.