From 7e02c3664b8b19d98388c6e3e36a37ca08b3b948 Mon Sep 17 00:00:00 2001 From: lfchener Date: Sun, 27 Sep 2020 02:46:36 +0000 Subject: [PATCH] use core.op in add_position_encoding API. --- python/paddle/fluid/layers/nn.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index 774630e7ef5..abeb0919057 100755 --- a/python/paddle/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -13166,6 +13166,10 @@ def add_position_encoding(input, alpha, beta, name=None): input=tensor, alpha=1.0, beta=1.0) """ + if in_dygraph_mode(): + return core.ops.add_position_encoding(input, "alpha", alpha, "beta", + beta) + helper = LayerHelper('add_position_encoding', **locals()) check_variable_and_dtype(input, 'input', ['float32', 'float64'], "add_position_encoding") -- GitLab