-
Notifications
You must be signed in to change notification settings - Fork 75.2k
[tflite] export SetNumThreads to TFLite Python API #25748
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[tflite] export SetNumThreads to TFLite Python API #25748
Conversation
|
added @miaout17 to the reviewer list since it involves interpreter change. |
|
Mine built well, but I get an object has no attribute |
|
@jdinkel88 maybe you forgot to install the newly built pip wheel (remember to |
|
@petewarden can you review this? RPI right now runs the apps using the python binding on single core :( |
|
👍 |
|
@miaout17 can you help review this? it seems some guys using RPI really want this. |
|
@miaout17 is there anyone else you can nominate as reviewer in case you don't have cycles? |
dpsm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verified on rpi that it indeed uses more than a single core
export SetNumThreadS() and add an option to set the number of threads in the `label_image.py` for TFLite.
| [TfLiteDelegate](https://www.tensorflow.org/lite/performance/delegates) | ||
| objects returned by lite.load_delegate(). | ||
| num_threads: Set the number of threads used by TFLite kernels. | ||
| If not set, kernels are running single-threaded. Note that currently, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should really be:
"Sets the number of threads used by the interpreter and available to CPU kernels. If not set, the interpreter will use an implementation-dependent default number of threads. Currently, only a subset of kernels, such as conv, support multi-threading."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| help='input standard deviation') | ||
| parser.add_argument( | ||
| '--num_threads', | ||
| default=1, type=int, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would prefer that the default be None, if possible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
@jdduke gentle ping if we need more changes here. |
jdduke
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test or two in interpreter_test.py? Validate that it throws an error for invalid input, and that 2 threads works as expected?
|
I can add the tests internally, so that we don't have to reimport the changes. Will do it by tomorrow and get this in. |
|
How can I make a pip package to test it on RPI 4? |
export SetNumThreads() and add an option to set the number of threads in the
label_image.pyfor TFLite. On PYNQ-Z1, a board with 2xCA9,