(weight, BM, BY, bm, by, M, K)
| 496 | # TL1 |
| 497 | |
| 498 | def process_tl1(weight, BM, BY, bm, by, M, K): |
| 499 | final_weight = [] |
| 500 | |
| 501 | # split in row with size of BM (160) |
| 502 | outer_BM_weights = np.split(weight, (M // BM), axis=0) |
| 503 | for outer_BM_weight in outer_BM_weights: |
| 504 | # split in col with size of by (16index * 2 == 32nums) |
| 505 | outer_BY_weights = np.split(outer_BM_weight, (K // BY), axis=1) |
| 506 | for outer_BY_weight in outer_BY_weights: |
| 507 | # split in row with size of bm (32) |
| 508 | inner_bm_weights = np.split(outer_BY_weight, (BM // bm), axis=0) |
| 509 | for inner_bm_weight in inner_bm_weights: |
| 510 | # split in col with size of by (2index * 2 == 4nums) |
| 511 | inner_by_weights = np.split(inner_bm_weight, (BY // by), axis=1) |
| 512 | for inner_by_weight in inner_by_weights: |
| 513 | # 16 * 6 minor |
| 514 | minor_bm_weights = np.split(inner_by_weight, (bm // 16), axis=0) |
| 515 | for minor_bm_weight in minor_bm_weights: |
| 516 | minor_by_weights = np.split(minor_bm_weight, (by // 4), axis=1) |
| 517 | for minor in minor_by_weights: |
| 518 | minor_weight = np.split(minor, 2, axis=1) |
| 519 | hi_weight = minor_weight[0].astype(np.uint8) << 4 |
| 520 | lo_weight = minor_weight[1].astype(np.uint8) |
| 521 | func_weight = lo_weight + hi_weight |
| 522 | final_weight.append(func_weight) |
| 523 | |
| 524 | weight = np.array(final_weight, dtype=np.uint8) |
| 525 | return weight |
| 526 | |
| 527 | # based on t_mac.utils.preprocess_weights |
| 528 | def preprocess_weights_tl1( |
no test coverage detected