未验证 提交 14013a2e 编写于 作者: A Aurelius84 提交者: GitHub

Remove prettytable in requirements.txt (#29100)

上级 b052149d
...@@ -34,7 +34,6 @@ Example: ...@@ -34,7 +34,6 @@ Example:
Total FLOPs: 11692747751(11.69G) Total FLOPs: 11692747751(11.69G)
''' '''
from collections import OrderedDict from collections import OrderedDict
from prettytable import PrettyTable
def summary(main_prog): def summary(main_prog):
...@@ -149,6 +148,8 @@ def _format_summary(collected_ops_list): ...@@ -149,6 +148,8 @@ def _format_summary(collected_ops_list):
summary_table: summary report format summary_table: summary report format
total: sum param and flops total: sum param and flops
''' '''
_verify_dependent_package()
summary_table = PrettyTable( summary_table = PrettyTable(
["No.", "TYPE", "INPUT", "OUTPUT", "PARAMs", "FLOPs"]) ["No.", "TYPE", "INPUT", "OUTPUT", "PARAMs", "FLOPs"])
summary_table.align = 'r' summary_table.align = 'r'
...@@ -176,6 +177,18 @@ def _format_summary(collected_ops_list): ...@@ -176,6 +177,18 @@ def _format_summary(collected_ops_list):
return summary_table, total return summary_table, total
def _verify_dependent_package():
"""
Verify whether `prettytable` is installed.
"""
try:
from prettytable import PrettyTable
except ImportError:
raise ImportError(
"paddle.summary() requires package `prettytable`, place install it firstly using `pip install prettytable`. "
)
def _print_summary(summary_table, total): def _print_summary(summary_table, total):
''' '''
Print all the summary on terminal. Print all the summary on terminal.
......
...@@ -11,6 +11,5 @@ rarfile ...@@ -11,6 +11,5 @@ rarfile
Pillow Pillow
six six
decorator decorator
prettytable
astor astor
pathlib pathlib
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册