如何获取训练过程中的所有梯度?
如何获取训练中的所有梯度,并且像模型一样保存下来?
np.array(fluid.global_scope().find_var('embedding_name').get_tensor())
@colourful-tree 有批量的接口吗?就像save model一样?
好像没有哈
按照np.array(fluid.global_scope().find_var('embedding_name').get_tensor())****方法,梯度无法获取,显示
请问是否有其他方式?
fluid.default_main_program().list_vars()可以或者所有的Variable,其中name带@GRAD的都是梯度
@heavengate 通过list_vars()是可以看到user.w@GRAD这个变量的,但是find_var时就是找不到

@heavengate 通过list_vars()是可以看到user.w@GRAD这个变量的,但是find_var时就是找不到
list_vars()的时候把var.persistable 打出来看下这个梯度是不是persistable的
可以将 user.w@GRAD 加到fetch_list中,通过exe.run fetch出来
Since you haven't replied for more than a year, we have closed this issue/pr. If the problem is not solved or there is a follow-up one, please reopen it at any time and we will continue to follow up. 由于您超过一年未回复,我们将关闭这个issue/pr。 若问题未解决或有后续问题,请随时重新打开,我们会继续跟进。