Numpy into Tensor

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))

You can just try torch.from_numpy()

yes´╝îI know it. but I need tensor format to complete the above code.
Could you help me with it? Thanks a lot.

Do something like this, whenever you need to create a tensor from a numpy array.

OUT_tensor = torch.from_numpy(OUT)

after the loop completes.