From c7c4cec72241f883cfa74953aa1b0f4a74c606c0 Mon Sep 17 00:00:00 2001 From: Weilong Wu Date: Fri, 2 Sep 2022 10:57:11 +0800 Subject: [PATCH] [Eager] fix multiplex interface under different mode (#45645) --- python/paddle/tensor/math.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/paddle/tensor/math.py b/python/paddle/tensor/math.py index 8b3b0028e07..11a6d2d44f8 100644 --- a/python/paddle/tensor/math.py +++ b/python/paddle/tensor/math.py @@ -299,8 +299,11 @@ def multiplex(inputs, index, name=None): print(res) # Tensor([[5., 6.], [3., 4.]], dtype=float32) """ - if _non_static_mode(): + if in_dygraph_mode(): + return _C_ops.multiplex(inputs, index) + elif _in_legacy_dygraph(): return _legacy_C_ops.multiplex(index, inputs) + helper = LayerHelper('multiplex', **locals()) check_type(inputs, 'inputs', (list), 'multiplex') -- GitLab