OpenAI baselines: Why simultaneously use `tf.stop_gradient` and specify `var_list`?

天大地大妈咪最大 提交于 2019-12-11 02:51:00

问题


In OpenAI baselines code on DQN, tf.stop_gradient is used on the q values of the target network during building the operation graph to prevent the contributions of the target q values to the minimization of the loss. (line 213)

However, when calling minimize, the var_list is specified as only the tf.Variable with scope that falls under the q network being optimized, excluding the variables with scope under the target q network. (line 223)

I'm not sure why they do both. The two approaches seem to achieve the same result.


回答1:


It's redundant. IMO code reads better - you know that gradient will not flow through that expression, and also you know exactly which variables will be affected.

One would indeed suffice to achieve equivalent effect.



来源:https://stackoverflow.com/questions/44252741/openai-baselines-why-simultaneously-use-tf-stop-gradient-and-specify-var-lis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!