KellenSunderland commented on a change in pull request #11325: Added TensorRT runtime integration URL: https://github.com/apache/incubator-mxnet/pull/11325#discussion_r197798293
########## File path: example/image-classification/tensorrt/test_tensorrt_resnet50.py ########## @@ -0,0 +1,186 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +from __future__ import print_function + +import os.path +import subprocess +import mxnet as mx +import numpy as np +from time import time +import sys +import urllib + +def get_use_tensorrt(): + return int(os.environ.get("MXNET_USE_TENSORRT", 0)) + +def set_use_tensorrt(status = False): + os.environ["MXNET_USE_TENSORRT"] = str(int(status)) + +def download_file(url, local_fname=None, force_write=False): + # requests is not default installed + import requests + if local_fname is None: + local_fname = url.split('/')[-1] + if not force_write and os.path.exists(local_fname): + return local_fname + + dir_name = os.path.dirname(local_fname) + + if dir_name != "": + if not os.path.exists(dir_name): + try: # try to create the directory if it doesn't exists + os.makedirs(dir_name) + except OSError as exc: + if exc.errno != errno.EEXIST: Review comment: Missing errno import? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
