Created by: wawltor
import paddle.fluid as fluid import numpy as np x = fluid.data(name="x", shape=[20, 10, 10], dtype='float32') y = fluid.data(name="y", shape=[-1, 10], dtype='float32') c = fluid.layers.elementwise_add( x, y ) d = x + y place = fluid.CPUPlace() exe = fluid.Executor(place) x_np = np.random.uniform( -1, 1, [20, 10, 10]).astype("float32") y_np = np.random.uniform( -1, 1, [1, 10]).astype("float32") out = exe.run(feed={ "x" : x_np , "y" : y_np }, fetch_list=[ c, d] ) print( np.array_equal( out[0], out[1])) ## result is False