guberti commented on code in PR #13752:
URL: https://github.com/apache/tvm/pull/13752#discussion_r1113879454
##########
python/tvm/topi/arm_cpu/qnn.py:
##########
@@ -17,25 +17,40 @@
"""Contains TVMScript implementations of some QNN operators for Arm.
Currently, the only ops with compute functions are fused regular and depthwise
convolutions for
-Arm Cortex-M with DSP.
+Arm Cortex-M with DSP. Additionally, these functions explicitly do not support
padding - it
+must be done in a separate Relay op for memory reasons.
"""
-from typing import Tuple
+from typing import Callable, Dict, Tuple
import tvm
-from tvm import te
-from tvm.tir import const
+from tvm import te, tir, TVMError
from tvm.script import tir as T
+from tvm.tir import const
+
from ..utils import get_const_tuple
from .mprofile.dsp.micro_kernel import tensordot
-def int_ceil_division(x, y):
+def _int_ceil_division(x, y):
return -(x // -y)
def _compute_output_dim(data_length, kernel_length, stride):
- return int_ceil_division(data_length + 1 - kernel_length, stride)
+ return _int_ceil_division(data_length + 1 - kernel_length, stride)
+
+
+def _pick_num_outputs(out_width):
+ """Guess a good value for num_outputs."""
+
+ assert out_width > 1
+
+ # num_outputs is capped at 8
+ for i in range(2, min(out_width + 1, 8)):
+ if out_width % i == 0:
Review Comment:
Yep! Otherwise we would have to implement a "special case" for left-over
values. At some point, this will have to be done.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]