data = fluid.data(name='data', shape=[1], dtype='float32')
sums = fluid.layers.fill_constant(shape=[1], dtype='float32', value=0) # Define the variable to be obtained ouside of While, which name should be different from the variable inside the While to be obtained
fluid.layers.assign(sums_tensor, sums) # Update the value of sums_tensor defined in While to the sums which defined outside of While through layers.assign
i = fluid.layers.increment(x=i, value=1, in_place=True)
data = fluid.layers.elementwise_add(x=data, y=one)