I don’t know how you are comparing these two outputs, but make sure to create a clone of the input numpy array, since you are manipulating it inplace.
Also, note that ToTensor() will normalize numpy arrays, if they are passed in the uint8 dtype, not if they are using the float32 type.
Additionally, I’ve removed the resizing, as I don’t know what kind of interpolation is used by OpenCV by default.
Given that, your method works fine:
def normalize_cv2(image, mean, std):
    for d in range(3):
        image[d, :, :] = np.divide(image[d, :, :], 255)
        image[d, :, :] = np.divide(np.subtract(image[d, :, :], mean[d]), std[d])
    return image


mean = np.array([0.5, 0.5, 0.5])
std = np.array([0.5, 0.5, 0.5])
cvresized = np.random.randint(0, 256, (3, 250, 250)).astype(np.float32)
x = copy.deepcopy(cvresized)
normalized_cvimage = normalize_cv2(cvresized, mean, std)

transform = transforms.Compose([
    transforms.ToTensor(),
    transforms.Normalize(mean, std)  
])


out = transform(x.transpose(1, 2, 0).astype(np.uint8))
print(np.max(np.abs((out.numpy() - normalized_cvimage))))
> 0.0