Skip to content

Commit 773f2f7

Browse files
committed
fix errors
1 parent 51985aa commit 773f2f7

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

python/paddle/v2/fluid/clip.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ def process_context(self, context, param, grad):
138138
cls = self.__class__
139139
cls.check_init()
140140

141-
local_norm_var = layers.reduce_sum(
142-
x=layers.pow(x=grad, factor=2), reduce_all=True)
141+
local_norm_var = layers.reduce_sum(input=layers.pow(x=grad, factor=2.0))
143142
layers.sums(
144143
input=[local_norm_var, cls.global_norm_var],
145144
out=[cls.global_norm_var])
@@ -154,6 +153,8 @@ def create_operators(self, param, grad):
154153
x=cls.clip_norm_var,
155154
y=layers.elementwise_max(
156155
x=cls.clip_norm_var, y=cls.global_norm_var))
156+
assert cls.scale_var.shape == (1L, )
157+
157158
new_grad = layers.elementwise_mul(x=grad, y=cls.scale_var)
158159
return param, new_grad
159160

python/paddle/v2/fluid/layers/ops.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
'mean', 'mul', 'reshape', 'scale', 'transpose',
4949
'sigmoid_cross_entropy_with_logits', 'elementwise_add', 'elementwise_div',
5050
'elementwise_sub', 'elementwise_mul', 'elementwise_max', 'elementwise_min',
51-
'clip', 'clip_by_norm', 'sequence_softmax', 'reduce_sum'
51+
'clip', 'clip_by_norm', 'sequence_softmax'
5252
] + __activations__
5353

5454
for _OP in set(__all__):

0 commit comments

Comments
 (0)