未验证 提交 73e34e77 编写于 作者: D dyning 提交者: GitHub

Merge pull request #75 from WuHaobo/py_3

be compatible with py3
...@@ -12,12 +12,12 @@ ...@@ -12,12 +12,12 @@
# 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.
import utils
import argparse import argparse
import utils
import numpy as np import numpy as np
import logging import logging
import time import time
from paddle.fluid.core import PaddleTensor
from paddle.fluid.core import AnalysisConfig from paddle.fluid.core import AnalysisConfig
from paddle.fluid.core import create_paddle_predictor from paddle.fluid.core import create_paddle_predictor
logging.basicConfig(level=logging.INFO) logging.basicConfig(level=logging.INFO)
...@@ -85,7 +85,7 @@ def create_operators(): ...@@ -85,7 +85,7 @@ def create_operators():
def preprocess(fname, ops): def preprocess(fname, ops):
data = open(fname).read() data = open(fname, 'rb').read()
for op in ops: for op in ops:
data = op(data) data = op(data)
...@@ -97,14 +97,14 @@ def main(): ...@@ -97,14 +97,14 @@ def main():
if not args.enable_benchmark: if not args.enable_benchmark:
assert args.batch_size == 1 assert args.batch_size == 1
assert args.use_fp16 == False assert args.use_fp16 is False
else: else:
assert args.use_gpu == True assert args.use_gpu is True
assert args.model_name is not None assert args.model_name is not None
assert args.use_tensorrt == True assert args.use_tensorrt is True
# HALF precission predict only work when using tensorrt # HALF precission predict only work when using tensorrt
if args.use_fp16 == True: if args.use_fp16 is True:
assert args.use_tensorrt == True assert args.use_tensorrt is True
operators = create_operators() operators = create_operators()
predictor = create_predictor(args) predictor = create_predictor(args)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册