be compatible with py3
parent
9acc8a7544
commit
cc476bf360
|
@ -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():
|
||||||
|
|
||||||
|
|
||||||
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():
|
||||||
|
|
||||||
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)
|
||||||
|
|
Loading…
Reference in New Issue