more modifications
This commit is contained in:
parent
30e5e29d48
commit
a7c3bc9ebd
tensorflow/lite/python
@ -213,6 +213,8 @@ class Interpreter(object):
|
|||||||
if num_threads:
|
if num_threads:
|
||||||
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:
|
||||||
|
raise ValueError('num_threads should >= 1')
|
||||||
self._interpreter.SetNumThreads(num_threads)
|
self._interpreter.SetNumThreads(num_threads)
|
||||||
|
|
||||||
# Each delegate is a wrapper that owns the delegates that have been loaded
|
# Each delegate is a wrapper that owns the delegates that have been loaded
|
||||||
|
@ -148,8 +148,8 @@ PYBIND11_MODULE(_pywrap_tensorflow_interpreter_wrapper, m) {
|
|||||||
)pbdoc")
|
)pbdoc")
|
||||||
.def(
|
.def(
|
||||||
"SetNumThreads",
|
"SetNumThreads",
|
||||||
[](InterpreterWrapper& self, int i) {
|
[](InterpreterWrapper& self, int num_threads) {
|
||||||
return tensorflow::PyoOrThrow(self.SetNumThreads(i));
|
return tensorflow::PyoOrThrow(self.SetNumThreads(num_threads));
|
||||||
},
|
},
|
||||||
R"pbdoc(
|
R"pbdoc(
|
||||||
ask the interpreter to set the number of threads to use.
|
ask the interpreter to set the number of threads to use.
|
||||||
|
Loading…
Reference in New Issue
Block a user