diff --git a/python/paddle/tensor/math.py b/python/paddle/tensor/math.py index 8b3b0028e071c97e269d9dbcac020afaef9fc882..11a6d2d44f8cf61c4eb307d16c50728b0ba1c115 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')