From 957e182a900eca91343fb03cc6adeda880e578b1 Mon Sep 17 00:00:00 2001 From: hong <43953930+phlrain@users.noreply.github.com> Date: Fri, 20 Dec 2019 15:06:48 +0800 Subject: [PATCH] revert a+b axis change; test=develop (#21821) --- python/paddle/fluid/layers/math_op_patch.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python/paddle/fluid/layers/math_op_patch.py b/python/paddle/fluid/layers/math_op_patch.py index 5a9f7705369..3a164a2fd0c 100644 --- a/python/paddle/fluid/layers/math_op_patch.py +++ b/python/paddle/fluid/layers/math_op_patch.py @@ -225,13 +225,15 @@ def monkey_patch_variable(): other_var = tmp out = create_new_tmp_var(current_block(self), dtype=lhs_dtype) - + axis = -1 + if other_var.shape[0] == -1: + axis = 0 current_block(self).append_op( type=op_type, inputs={'X': [self], 'Y': [other_var]}, outputs={'Out': out}, - attrs={'axis': -1}) + attrs={'axis': axis}) return out comment = OpProtoHolder.instance().get_op_proto(op_type).comment -- GitLab