Created by: zhiqiu
This PR supports the rare case when user adds feed variables in fetch_list, and set use_prune=True
in exe.run()
in the model.
Code example,
x1 = fluid.data(name="x_1", shape=[None, 3, 4], dtype="float32")
x2 = fluid.data(name="x_2", shape=[None, 3, 4], dtype="float32")
x3 = fluid.data(name="x_3", shape=[None, 3, 4], dtype="float32")
x4 = fluid.data(name="x_4", shape=[None, 3, 4], dtype="float32")
output1 = fluid.layers.elementwise_add(x1, x2)
place = fluid.CPUPlace()
exe = fluid.Executor(place)
exe.run(fluid.default_startup_program())
input1 = np.random.random(size=(3, 3, 4)).astype("float32")
input2 = np.random.random(size=(3, 3, 4)).astype("float32")
feedData = {"x_1": input1, "x_2": input2}
fetch_list = [x1.name, x2.name, output1.name] # x1 and x2 is the feed variable
x1, x2, res1 = exe.run(feed=feedData, fetch_list=fetch_list)