I guess the transformation to uint8 could create an all-zero image as described in the comments:
# ToTensor returns a tensor in the range [0, 1]
preprocess_img = transforms.Compose([transforms.ToTensor()])(cpy_img) 
# add dimension
out_img_tensor = preprocess_img.squeeze(0)
# transform float32 [0, 1] to uint8 [0, 255], which will create the black image
out_img_type = out_img_tensor.type(torch.uint8)

so you could scale the pixel values to e.g. [0, 255] before transforming them.