提交 8fd1c4cb 编写于 作者: Z zhenghuanhuan

[MA][diff_privacy][Func] the dpoptimizer run failed and show obj must set_grad

https://gitee.com/mindspore/dashboard?issue_id=I1JXSM
[MA][diff_privacy][Func] Test Cases Fail Because the MindArmour Version Not Match
https://gitee.com/mindspore/dashboard?issue_id=I1KQK5
上级 8471da24
......@@ -303,6 +303,7 @@ class _TrainOneStepWithLossScaleCell(Cell):
def __init__(self, network, optimizer, scale_update_cell=None, micro_batches=None, l2_norm_clip=1.0, mech=None):
super(_TrainOneStepWithLossScaleCell, self).__init__(auto_prefix=False)
self.network = network
self.network.set_grad()
self.network.add_flags(defer_inline=True)
self.weights = ParameterTuple(network.trainable_params())
self.optimizer = optimizer
......@@ -450,6 +451,7 @@ class _TrainOneStepCell(Cell):
def __init__(self, network, optimizer, sens=1.0, micro_batches=None, l2_norm_clip=1.0, mech=None):
super(_TrainOneStepCell, self).__init__(auto_prefix=False)
self.network = network
self.network.set_grad()
self.network.add_flags(defer_inline=True)
self.weights = optimizer.parameters
self.optimizer = optimizer
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册