In the following procedure, how should the numpy format be transformed into a tensor format? thanks

OUT = np.zeros((N,F,Ho,Wo))
for f in xrange(F):
  for i in xrange(Ho):
    for j in xrange(Wo):
      OUT[:,f,i,j] = np.sum(x_pad[:, :, i*S : i*S+HH, j*S : j*S+WW] * w[f, :, :, :], axis=(1, 2, 3))