PaddlePaddle1.7.0, act='hard_sigmoid' is not available in paddle.fluid.dygraph.Conv2D()
Created by: imchinfei
PaddlePaddle1.7.0中, paddle.fluid.dygraph.Conv2D中, act = 'hard_sigmoid'功能不正常, 同样的代码在PaddlePaddle1.6.0中使用正常.
以下为简单的复现代码
from paddle.fluid.dygraph.base import to_variable
import paddle.fluid as fluid
from paddle.fluid.dygraph import Conv2D
import numpy as np
data = np.random.uniform(-1, 1, [10, 3, 32, 32]).astype('float32')
place = fluid.CPUPlace()
with fluid.dygraph.guard(place):
conv2d = Conv2D(3, 2, 3, act = 'hard_sigmoid')
# conv2d = Conv2D(3, 2, 3)
data = to_variable(data)
conv = conv2d(data)
报错为
Traceback (most recent call last):
File "/ssd3/qinfei/work/mobilefacenet_qf/ceshi.py", line 11, in <module>
conv = conv2d(data)
File "/ssd3/qinfei/envs/anaconda2/lib/python2.7/site-packages/paddle/fluid/dygraph/layers.py", line 304, in __call__
outputs = self.forward(*inputs, **kwargs)
File "/ssd3/qinfei/envs/anaconda2/lib/python2.7/site-packages/paddle/fluid/dygraph/nn.py", line 241, in forward
self._act)
File "</ssd3/qinfei/envs/anaconda2/lib/python2.7/site-packages/decorator.pyc:decorator-gen-28>", line 2, in _append_activation_in_dygraph
File "/ssd3/qinfei/envs/anaconda2/lib/python2.7/site-packages/paddle/fluid/wrapped_decorator.py", line 25, in __impl__
return wrapped_func(*args, **kwargs)
File "/ssd3/qinfei/envs/anaconda2/lib/python2.7/site-packages/paddle/fluid/framework.py", line 207, in __impl__
return func(*args, **kwargs)
File "/ssd3/qinfei/envs/anaconda2/lib/python2.7/site-packages/paddle/fluid/dygraph/dygraph_utils.py", line 40, in _append_activation_in_dygraph
res = act_op(inputs, attrs)
RuntimeError: boost::bad_get: failed value get using boost::get