diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index 774630e7ef5cdaabfcfc8aac90822b37c47e532c..abeb09190575bf09a63ecf88ffa21dbb1b84af3c 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")