TVM code generation has redundant border?

Using the below tvm code:
A = tvm.placeholder((1080, 1920), name=‘A’, dtype=dtype)
K = tvm.placeholder((3, 3), name=‘K’, dtype=dtype)
ry = tvm.reduce_axis((0, 3), name=‘ry’)
rx = tvm.reduce_axis((0, 3), name=‘rx’)

C = tvm.compute((1080-2, 1920-2), lambda i, j: tvm.sum((A[i + ry, j + rx] *K[ry, rx]), axis=[ry, rx]), name=‘C’)
print(“C shape:”, C.shape)

pad_before = [1, 1]
pad_after = [1, 1]
F = topi.nn.pad(C, pad_before, pad_after, name=“pad_F”)
print(“F shape:”, F.shape)

s = tvm.create_schedule(F.op)
print(tvm.lower(s, [A, K, C, F], simple_mode=True))

The print IR code is:

C shape: [1078, 1918]
F shape: [1080, 1920]
produce C {
for (i, 0, 1080) {
	for (j, 0, 1920) {
		C[(((i1918) + j) + -1919)] = 0.000000f
		for (ry, 0, 3) {
			for (rx, 0, 3) {
				if (likely((1 <= i))) {
				if (likely((i < 1079))) {
				if (likely((1 <= j))) {
				if (likely((j < 1919))) {
					C[(((i1918) + j) + -1919)] = (C[(((i1918) + j) + -1919)] + (A[(((((i + ry)1920) + j) + rx) + -1921)]K[((ry3) + rx)]))
				}
				}
				}
				}
			}
		}
	}
}
}
produce pad_F {
for (i0, 0, 1080) {
	for (i1, 0, 1920) {
		ad_F[((i01920) + i1)] = tvm_if_then_else(((((1 <= i0) && (i0 < 1079)) && (1 <= i1)) && (i1 < 1919)), C[(((i0*1918) + i1) + -1919)], 0.000000f)
	}
}
}

The C shape is [1078, 1918], Why the i and j axis of product C’s range is (0, 1080) and (0,1920)?

Hey, I am not 100% sure but maybe if you look in this post you will see what might be the cause.

Even though the linked post is old and I think there wasn’t a definite answer, the schedule.normalize() will bring all the loops to a common representation (in this case since C can be embedded in the iteration space of F, the boundaries are those of F)