From 75cbdf9807d034be038ad7db8cf36a72fb126ec6 Mon Sep 17 00:00:00 2001 From: qiaolongfei Date: Sat, 1 Apr 2017 00:26:44 +0800 Subject: [PATCH] fix reset of Plot --- python/paddle/v2/plot/plot.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/python/paddle/v2/plot/plot.py b/python/paddle/v2/plot/plot.py index 1c56294368c..4e9e92652e5 100644 --- a/python/paddle/v2/plot/plot.py +++ b/python/paddle/v2/plot/plot.py @@ -54,7 +54,10 @@ class Plot(object): self.plt.gcf().clear() def reset(self): - self.__plot_data__ = [] + for key in self.__plot_data__: + data = self.__plot_data__[key] + assert isinstance(data, PlotData) + data.reset() if __name__ == '__main__': title = "cost" @@ -63,3 +66,7 @@ if __name__ == '__main__': plot_test.append(title, 2, 2) for k, v in plot_test.__plot_data__.iteritems(): print k, v.step, v.value + plot_test.reset() + for k, v in plot_test.__plot_data__.iteritems(): + print k, v.step, v.value +gg -- GitLab