[Solved]Divide by zero during backward

My code halted with following error.

File “train.py”, line 466, in main
File “/opt/conda/lib/python3.6/site-packages/torch/tensor.py”, line 93, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File “/opt/conda/lib/python3.6/site-packages/torch/autograd/init.py”, line 90, in backward
allow_unreachable=True) # allow_unreachable flag
RuntimeError: invalid argument 3: divide by zero at /opt/conda/conda-bld/pytorch_1532579805626/work/aten/src/THC/generic/THCTensorMathPairwise.cu:88

Backward through a mean where the input of the mean is an size-0 tensor.