torch.clamp_min_方法设置一个下限min,tensor中有元素小于这个值, 就把对应的值赋为min
>>> zz1
tensor([ 130, 144, 183, 609, 818, 832, 891, 1386, 1494, 1729, 1739, 1785,
2671, 2802, 3444, 4711, 4754, 4763, 5728, 5842])
>>> zz2 = zz1.clamp_min_(1000)
>>> zz2
tensor([1000, 1000, 1000, 1000, 1000, 1000, 1000, 1386, 1494, 1729, 1739, 1785,
2671, 2802, 3444, 4711, 4754, 4763, 5728, 5842])
loss_v = loss.clamp_min_(1e-30).log_().mean() * (-1)