提交 aca53535 编写于 作者: H Hongyu Liu 提交者: Jiabin Yang

fix bug; test=develop (#17733)

上级 0a02451e
...@@ -1461,8 +1461,8 @@ class GRUUnit(layers.Layer): ...@@ -1461,8 +1461,8 @@ class GRUUnit(layers.Layer):
sigmoid=1, sigmoid=1,
tanh=2, tanh=2,
relu=3, ) relu=3, )
activation = activation_dict[activation] self.activation = activation_dict[activation]
gate_activation = activation_dict[gate_activation] self.gate_activation = activation_dict[gate_activation]
self._dtype = dtype self._dtype = dtype
size = size // 3 size = size // 3
...@@ -1494,8 +1494,8 @@ class GRUUnit(layers.Layer): ...@@ -1494,8 +1494,8 @@ class GRUUnit(layers.Layer):
'Hidden': updated_hidden, 'Hidden': updated_hidden,
}, },
attrs={ attrs={
'activation': 2, # tanh 'activation': self.activation,
'gate_activation': 1, # sigmoid 'gate_activation': self.gate_activation,
}) })
return updated_hidden, reset_hidden_pre, gate return updated_hidden, reset_hidden_pre, gate
...@@ -2053,7 +2053,7 @@ class Conv2DTranspose(layers.Layer): ...@@ -2053,7 +2053,7 @@ class Conv2DTranspose(layers.Layer):
self._filter_size = [filter_size_h, filter_size_w] self._filter_size = [filter_size_h, filter_size_w]
else: else:
self._filter_size = utils.convert_to_list( self._filter_size = utils.convert_to_list(
self._output_size, 2, 'conv2d_transpose.filter_size') self._filter_size, 2, 'conv2d_transpose.filter_size')
if self._output_size is None: if self._output_size is None:
self._output_size = [] self._output_size = []
......
...@@ -42,7 +42,9 @@ def monkey_patch_variable(): ...@@ -42,7 +42,9 @@ def monkey_patch_variable():
'shape': shape, 'shape': shape,
'value': value, 'value': value,
'force_cpu': force_init_on_cpu() 'force_cpu': force_init_on_cpu()
}) },
stop_gradient=True)
var.stop_gradient = True
return var return var
def create_scalar(block, value, dtype): def create_scalar(block, value, dtype):
...@@ -68,7 +70,10 @@ def monkey_patch_variable(): ...@@ -68,7 +70,10 @@ def monkey_patch_variable():
'value': value, 'value': value,
'input_dim_idx': batch_dim, 'input_dim_idx': batch_dim,
'output_dim_idx': batch_dim 'output_dim_idx': batch_dim
}) },
stop_gradient=True)
var.stop_gradient = True
return var return var
def astype(self, dtype): def astype(self, dtype):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册