如何在优化中获取神经网络的动量项

|我有一个torch7中的神经网络,并希望检查神经网络的动量如何发展,因为我想修改/减少它,因为我想对值进行一些额外的处理,并需要速度项才能这样做。 因此,我有以下代码:

for t = 1, params.num_iterations do
  local x, losses = optim.adam(feval, img, optim_state)
        img=postProccess(img,content_imageprep,params)
        print(velocity) -- 如何?
end

我想看到速度在做什么。 有人知道如何做到这一点吗?

打印optim_state会输出以下内容

  v : CudaTensor - size: 1327104
  m : CudaTensor - size: 1327104
  learningRate : 10
  denom : CudaTensor - size: 1327104
  t : 4

但我不确定是否以及如果是什么项表示速度,有人知道吗?

点赞
用户3754413
用户3754413

你不会在 state 参数中找到动量的值,而是需要在 config 参数中寻找(在你的函数调用中缺失了该参数),那么动量的值将等于其默认值,即 beta1 为0.9,beta2 为0.999。

请查看源代码 https://github.com/torch/optim/blob/master/adam.lua#L24

2017-06-13 14:29:47