提交 bde1e8fe 编写于 作者: Q qiaolongfei

mv IPython to if guard for test

上级 1f76fb87
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from IPython import display
import os import os
...@@ -39,7 +38,9 @@ class Ploter(object): ...@@ -39,7 +38,9 @@ class Ploter(object):
self.__disable_plot__ = os.environ.get("DISABLE_PLOT") self.__disable_plot__ = os.environ.get("DISABLE_PLOT")
if not self.__plot_is_disabled__(): if not self.__plot_is_disabled__():
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
from IPython import display
self.plt = plt self.plt = plt
self.display = display
def __plot_is_disabled__(self): def __plot_is_disabled__(self):
return self.__disable_plot__ == "True" return self.__disable_plot__ == "True"
...@@ -63,8 +64,8 @@ class Ploter(object): ...@@ -63,8 +64,8 @@ class Ploter(object):
titles.append(title) titles.append(title)
self.plt.plot(data.step, data.value) self.plt.plot(data.step, data.value)
self.plt.legend(titles, loc='upper left') self.plt.legend(titles, loc='upper left')
display.clear_output(wait=True) self.display.clear_output(wait=True)
display.display(self.plt.gcf()) self.display.display(self.plt.gcf())
self.plt.gcf().clear() self.plt.gcf().clear()
def reset(self): def reset(self):
......
...@@ -21,6 +21,7 @@ popd > /dev/null ...@@ -21,6 +21,7 @@ popd > /dev/null
cd $SCRIPTPATH cd $SCRIPTPATH
$1 -m pip install ../../../../../paddle/dist/*.whl $1 -m pip install ../../../../../paddle/dist/*.whl
export DISABLE_PLOT="True"
test_list="test_ploter.py" test_list="test_ploter.py"
export PYTHONPATH=$PWD/../../../../../python/ export PYTHONPATH=$PWD/../../../../../python/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册