本文主要是介绍PyTorch训练中 Loss为负数,且不断减小,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
在To.Tensor()中会将图像归一化,但是对于一些数据不会归一化,看看标签和数据是否在一个范围内
Pytorch1.01中ToTensor解释
Convert a PIL Image or numpy.ndarray to tensor.
Converts a PIL Image or numpy.ndarray (H x W x C) in the range [0, 255] to a torch.FloatTensor of shape (C x H x W) in the range [0.0, 1.0] if the PIL Image belongs to one of the modes (L, LA, P, I, F, RGB, YCbCr, RGBA, CMYK, 1) or if the numpy.ndarray has dtype = np.uint8
In the other cases, tensors are returned without scaling.
比如对于np.int32 就不会归一化
这篇关于PyTorch训练中 Loss为负数,且不断减小的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!