address review comments

This commit is contained in:
Koan-Sin Tan 2020-05-27 15:32:36 +08:00
parent b0c869a7eb
commit fd546daf61
2 changed files with 6 additions and 5 deletions

View File

@ -57,7 +57,7 @@ if __name__ == '__main__':
help='input standard deviation') help='input standard deviation')
parser.add_argument( parser.add_argument(
'--num_threads', '--num_threads',
default=1, type=int, default=None, type=int,
help='number of threads') help='number of threads')
args = parser.parse_args() args = parser.parse_args()

View File

@ -182,9 +182,10 @@ class Interpreter(object):
experimental_delegates: Experimental. Subject to change. List of experimental_delegates: Experimental. Subject to change. List of
[TfLiteDelegate](https://www.tensorflow.org/lite/performance/delegates) [TfLiteDelegate](https://www.tensorflow.org/lite/performance/delegates)
objects returned by lite.load_delegate(). objects returned by lite.load_delegate().
num_threads: Set the number of threads used by TFLite kernels. num_threads: Sets the number of threads used by the interpreter and
If not set, kernels are running single-threaded. Note that currently, available to CPU kernels. If not set, the interpreter will use an
only some kernels, such as conv, are multithreaded. implementation-dependent default number of threads. Currently,
only a subset of kernels, such as conv, support multi-threading.
Raises: Raises:
ValueError: If the interpreter was unable to create. ValueError: If the interpreter was unable to create.
@ -210,7 +211,7 @@ class Interpreter(object):
else: else:
raise ValueError('Can\'t both provide `model_path` and `model_content`') raise ValueError('Can\'t both provide `model_path` and `model_content`')
if num_threads: if num_threads is not None:
if not isinstance(num_threads, int): if not isinstance(num_threads, int):
raise ValueError('type of num_threads should be int') raise ValueError('type of num_threads should be int')
if num_threads < 1: if num_threads < 1: