Understanding interpolate of nn.functional

import torch
import torch.nn.functional as F

a = torch.arange(1, 5).view(1, 1, 2, 2).float()
a = F.interpolate(a, size=[4, 4], mode='bilinear')
print(a)

output is

tensor([[[[1.0000, 1.2500, 1.7500, 2.0000],
[1.5000, 1.7500, 2.2500, 2.5000],
[2.5000, 2.7500, 3.2500, 3.5000],
[3.0000, 3.2500, 3.7500, 4.0000]]]])

This part seems to be correct.

a = F.interpolate(a, size=[1, 4], mode='bilinear')
print(a)

The output is

tensor([[[[1.0000, 1.2500, 1.7500, 2.0000]]]])

How to understand the result?

As a comparison, cv2 gives the following result:

a = a[0].transpose(0, 1).transpose(1, 2)
a = cv2.resize(a.numpy(), (1, 4), interpolation=cv2.INTER_LINEAR)
print(a)

output:

[[1.5]
[2. ]
[3. ]
[3.5]]