tom-gall edited a comment on pull request #6145:
URL: https://github.com/apache/incubator-tvm/pull/6145#issuecomment-670194174
Since there isn't an RFC, I'll drop this comment here, what does a somewhat
working example look like?
Updating the micro tvm tutorial as inspiration :
target = "c --system-lib --runtime=c"
input_tensor = "dense_4_input"
input_shape = (1,)
input_dtype = "float32"
dev_config = micro.device.arm.stm32f746xx.generate_config("127.0.0.1", 6666)
mod, params = relay.frontend.from_tflite(tflite_model,
shape_dict={input_tensor:
input_shape},
dtype_dict={input_tensor:
input_dtype})
with micro.Session(dev_config) as sess:
ctx = tvm.micro_dev(0)
with tvm.transform.PassContext(disabled_pass={'FuseOps'},
config={"tir.disable_vectorize": True}):
graph, c_mod, params = relay.build(mod, target=target, params=params)
micro_mod = micro.create_micro_mod(c_mod, dev_config)
mod = graph_runtime.create(graph, micro_mod, ctx)
mod.set_input(**params)
mod.set_input(input_tensor, tvm.nd.array(np.array([0.5],
dtype="float32")))
mod.run()
# Get output
tvm_output = mod.get_output(0).asnumpy()
print("result is: "+str(tvm_output))
This feels like it should be close however it fails at
micro.create_micro_mod
/tmp/tmpok80dx2r/temp.c:232:5: warning: initialization of 'int (*)(TVMValue
*, int *, int, TVMValue *, int *, void *)' {aka 'int (*)(union <anonymous> *,
int *, int, union <anonymous> *, int *, void *)'} from incompatible pointer
type 'int32_t (*)(void *, void *, int32_t, void *, void *, void *)' {aka 'long
int (*)(void *, void *, long int, void *, void *, void *)'}
[-Wincompatible-pointer-types]
232 | fused_nn_dense_nn_bias_add_nn_relu,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/tmpok80dx2r/temp.c:232:5: note: (near initialization for
'_tvm_func_array[0]')
/tmp/tmpok80dx2r/temp.c:233:5: warning: initialization of 'int (*)(TVMValue
*, int *, int, TVMValue *, int *, void *)' {aka 'int (*)(union <anonymous> *,
int *, int, union <anonymous> *, int *, void *)'} from incompatible pointer
type 'int32_t (*)(void *, void *, int32_t, void *, void *, void *)' {aka 'long
int (*)(void *, void *, long int, void *, void *, void *)'}
[-Wincompatible-pointer-types]
233 | fused_reshape_1,
| ^~~~~~~~~~~~~~~
/tmp/tmpok80dx2r/temp.c:233:5: note: (near initialization for
'_tvm_func_array[1]')
/tmp/tmpok80dx2r/temp.c:234:5: warning: initialization of 'int (*)(TVMValue
*, int *, int, TVMValue *, int *, void *)' {aka 'int (*)(union <anonymous> *,
int *, int, union <anonymous> *, int *, void *)'} from incompatible pointer
type 'int32_t (*)(void *, void *, int32_t, void *, void *, void *)' {aka 'long
int (*)(void *, void *, long int, void *, void *, void *)'}
[-Wincompatible-pointer-types]
234 | fused_reshape,
| ^~~~~~~~~~~~~
/tmp/tmpok80dx2r/temp.c:234:5: note: (near initialization for
'_tvm_func_array[2]')
/tmp/tmpok80dx2r/temp.c:235:5: warning: initialization of 'int (*)(TVMValue
*, int *, int, TVMValue *, int *, void *)' {aka 'int (*)(union <anonymous> *,
int *, int, union <anonymous> *, int *, void *)'} from incompatible pointer
type 'int32_t (*)(void *, void *, int32_t, void *, void *, void *)' {aka 'long
int (*)(void *, void *, long int, void *, void *, void *)'}
[-Wincompatible-pointer-types]
235 | fused_nn_dense_nn_bias_add,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/tmpok80dx2r/temp.c:235:5: note: (near initialization for
'_tvm_func_array[3]')
/tmp/tmpok80dx2r/temp.c:236:5: warning: initialization of 'int (*)(TVMValue
*, int *, int, TVMValue *, int *, void *)' {aka 'int (*)(union <anonymous> *,
int *, int, union <anonymous> *, int *, void *)'} from incompatible pointer
type 'int32_t (*)(void *, void *, int32_t, void *, void *, void *)' {aka 'long
int (*)(void *, void *, long int, void *, void *, void *)'}
[-Wincompatible-pointer-types]
236 | fused_nn_dense_nn_bias_add_nn_relu_1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/tmpok80dx2r/temp.c:236:5: note: (near initialization for
'_tvm_func_array[4]')
/tmp/tmpok80dx2r/temp.c:237:1: error: expected expression before 'static'
237 | static const TVMFuncRegistry _tvm_func_registry = {
Should that be expected for the time being?
----------------------------------------------------------------
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]