forked from mindspore-Ecosystem/mindspore
!17937 Clean GradOperation inappropriate implementation.
Merge pull request !17937 from 张清华/grad_opt0
This commit is contained in:
commit
431c037ff5
|
@ -354,9 +354,9 @@ class GradOperation(GradOperation_):
|
|||
fn(*args, **new_kwargs)
|
||||
|
||||
def __call__(self, fn, weights=None):
|
||||
grad_ = GradOperation(self.get_all, self.get_by_list, self.sens_param)
|
||||
if self.grad_fn is not None and self.fn == fn:
|
||||
return self.grad_fn
|
||||
grad_ = GradOperation(self.get_all, self.get_by_list, self.sens_param)
|
||||
if context.get_context("mode") == context.GRAPH_MODE:
|
||||
if self.get_by_list:
|
||||
@ms_function(obj=fn)
|
||||
|
|
Loading…
Reference in New Issue