未验证 提交 62033f25 编写于 作者: W Weilong Wu 提交者: GitHub

[Eager, Performance optimization] fix prelu interface under eager mode (#45694)

上级 fb42ba70
......@@ -2418,6 +2418,9 @@ class PRelu(layers.Layer):
default_initializer=Constant(1.0))
def forward(self, input):
if in_dygraph_mode():
return _C_ops.prelu(input, self.weight, "NCHW", self._mode)
check_variable_and_dtype(input, 'input', ['float32'], 'PRelu')
out = self._helper.create_variable_for_type_inference(self._dtype)
self._helper.append_op(type="prelu",
......
......@@ -10259,6 +10259,9 @@ def prelu(x, mode, param_attr=None, data_format="NCHW", name=None):
dtype=dtype,
is_bias=False,
default_initializer=Constant(0.25))
if in_dygraph_mode():
return _C_ops.prelu(x, alpha, data_format, mode)
out = helper.create_variable_for_type_inference(dtype)
helper.append_op(type="prelu",
inputs={
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册