ZihengJiang commented on a change in pull request #4698: [Runtime] EdgeTPU
runtime for Coral Boards
URL: https://github.com/apache/incubator-tvm/pull/4698#discussion_r366016811
##########
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:
if these two create function share the same arguments, we can unify them as
one create function with different returned runtime
----------------------------------------------------------------
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