modify kernel transpose
@@ -161,6 +161,8 @@ class View(object):
else:
kn_out = int(od / NUM_PE)
idx_src = 0
+
+ if op._dimension_format == "NHWC":
for no in range(kn_out):
for ni in range(NUM_PE):
for h in range(kh):
@@ -173,6 +175,21 @@ class View(object):
idx_dst += ni
transpose_values[idx_dst] = copy_value[idx_src]
idx_src += 1
+ elif op._dimension_format == "NCHW":
+ for no in range(kn_out):
+ for ni in range(NUM_PE):
+ for c in range(k_c_by_word):
+ for h in range(kh):
+ for w in range(kw):
+ idx_dst = h * (kw * kn_out * k_c_by_word * NUM_PE)
+ idx_dst += w * (kn_out * k_c_by_word * NUM_PE)
+ idx_dst += no * (k_c_by_word * NUM_PE)
+ idx_dst += c * (NUM_PE)
+ idx_dst += ni
+ transpose_values[idx_dst] = copy_value[idx_src]
+ idx_src += 1
+ else:
+ NotImplementedError("only NCHW and NHWC formats are suppported")
transpose_string = "{" + ",".join([str(temp) for temp in transpose_values]) + "}"
# temporary: formula which derive number of qinput is not complete
