提交 a247972d 编写于 作者: F fengjiayi

fix a error

上级 958d07be
...@@ -134,8 +134,8 @@ class GradientClipByGlobalNorm(BaseGradientClipAttr): ...@@ -134,8 +134,8 @@ class GradientClipByGlobalNorm(BaseGradientClipAttr):
"Class 'GradientClipByGlobalNorm' has not been properly initialized. \ "Class 'GradientClipByGlobalNorm' has not been properly initialized. \
Please call GradientClipByGlobalNorm.init() first.") Please call GradientClipByGlobalNorm.init() first.")
@classmethod def process_context(self, context, param, grad):
def process_context(cls, context, param, grad): cls = self.__class__
cls.check_init() cls.check_init()
local_norm_var = layers.reduce_sum( local_norm_var = layers.reduce_sum(
...@@ -144,8 +144,8 @@ class GradientClipByGlobalNorm(BaseGradientClipAttr): ...@@ -144,8 +144,8 @@ class GradientClipByGlobalNorm(BaseGradientClipAttr):
input=[local_norm_var, cls.global_norm_var], input=[local_norm_var, cls.global_norm_var],
out=[cls.global_norm_var]) out=[cls.global_norm_var])
@classmethod def create_operators(self, param, grad):
def create_operators(cls, param, grad): cls = self.__class__
cls.check_init() cls.check_init()
if cls.scale_var is None: if cls.scale_var is None:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册