数组生成图片
image = Image.fromarray(np.uint8(arr))
#arr的shape必须是3在后面,比如(375,500,3)
tensor生成图片
trans = transforms.ToPILImage()
image = trans(tensor)
#tensor的shape须是3在后面,比如(3,375,500),而且就应该是三维的
#如果给的是四维的tensor,会报错 pic should be 2/3 dimensional. Got 4 dimensions.
#如果是(375,500,3),会报错pic should not have > 4 channels. Got 375 channels.