Created by: zhiqiu
PR types
Others
PR changes
APIs
Describe
Refine deprecated decorator, show deprecation warning once.
For the following case, the original deprecated
on reduce_mean
will print too many warnings, this PR fixes that.
import paddle
def model(x):
return paddle.fluid.layers.reduce_mean(x) # reduce_mean is decorated with @deprecated
paddle.disable_static()
for epoch in range(5):
for batch in range(100):
x = paddle.rand([2, 10])
loss = model(x)
if batch % 100 == 0:
print(loss)