tmoreau89 commented on a change in pull request #4698: [Runtime] EdgeTPU
runtime for Coral Boards
URL: https://github.com/apache/incubator-tvm/pull/4698#discussion_r367186135
##########
File path: python/tvm/contrib/tflite_runtime.py
##########
@@ -27,16 +27,25 @@ def create(tflite_model_bytes, ctx):
ctx : TVMContext
The context to deploy the module. It can be local or remote when there
is only one TVMContext.
+ target_edgetpu: bool
+ Targets execution on the edge TPU via tflite when running on the Coral
board.
+ Set to False by default.
Returns
-------
tflite_runtime : TFLiteModule
Runtime tflite module that can be used to execute the tflite model.
"""
device_type = ctx.device_type
if device_type >= rpc_base.RPC_SESS_MASK:
- fcreate = ctx._rpc_sess.get_function("tvm.tflite_runtime.create")
+ if target_edgetpu:
+ fcreate = ctx._rpc_sess.get_function("tvm.edgetpu_runtime.create")
+ else:
+ fcreate = ctx._rpc_sess.get_function("tvm.tflite_runtime.create")
return TFLiteModule(fcreate(bytearray(tflite_model_bytes), ctx))
- fcreate = get_global_func("tvm.tflite_runtime.create")
+ if target_edgetpu:
+ fcreate = get_global_func("tvm.edgetpu_runtime.create")
Review comment:
Unification here is less desired due to the fact that we won't always want
to build the edgeTPU runtime when building the TFLite runtime. The limitation
is that we need to build TVM with the edgeTPU library which comes in a separate
repo; it's an extra software dependence that is not always wanted for users of
vanilla TFLite.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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