Tflite arm_cpu only support NCHW?

I compile a tflite model for target x86 cpu, it works well. But when I change target to arm cpu,
it give me error msg like:
File “/tvm/topi/python/topi/arm_cpu/conv2d.py”, line 134, in _decl_spatial_pack
assert layout == “NCHW”, “Only support NCHW”

Could tflite change layout like API relay.frontend.from_tensorflow?

1 Like

TFLite of TVM only support NHWC as TFLite. spatial_pack of ARM CPU doesn’t support NHWC currently. The modification is not difficult (really easy). I am very appreciate someone could contribute it because I am busy on companies’s project. See: https://github.com/dmlc/tvm/pull/3141#issuecomment-500113736

Back to TVM Tensorflow frontend’s way. TVM TFLite frontend shouldn’t do like this. The most common situation using TVM TFLite frontend is ARM CPU, which has limit power. Maybe just 32 / 64 GFlops and so on. TVM Tensorflow frontend’s way is insert transpose op between convolution. We will have two transpose ops. In GPU, it is fine. But on CPU, the cost won’t be ignored, sometimes, the transpose will occupy much time. We should support spatila_pack on NHWC layout natively.

Hi, i build my tensorflow model to tvm ,and find it is slower than tf, do you think the reason is insert transpose op between convolution? or i should use auto tvm to tune a faster one? or auto tvm for tensorflow model is less help?

Maybe. You could use graph_runtime_debug to profile every layer’s time. Our one model is because of transpose op.