The comment in the code correctly states the equation for the shape inference as follows:
H = ((IH+pad_top+pad_bottom-(dilation_y*(KH-1)+1))/stride_y)+1
However the final operation is generated as - instead of +. I believe + is indeed correct. For example if we have an image with dimension 6 and kernel of dimension 3 (assuming padding is 0 and stride and dilation are both 1) we are expecting 4 elements in the output (computed for image elements (0, 1, 2) x kernel, (1, 2, 3) x kernel, (2, 3, 4) x kernel and (3, 4, 5) x kernel. However currently only 2 elements are produced in the output.