[cherry-pick]Update backward appending stragety to support double backward. (#18216)
* Update backward appending stragety to support double backward and fix some bug. (#18104) * Update backward.py: - If there is no input grad var in all outputs of previous ops, do not append this op into graph. - Only apply this stragety when double backward. * Update some double backward op. * Update sum_op to judge whether a tensor is empty by numel or IsInitialized().
Showing
想要评论请 注册 或 登录