| 580 | } |
| 581 | |
| 582 | void ClGemmConv2d::run(ITensorPack &tensors) |
| 583 | { |
| 584 | prepare(tensors); |
| 585 | |
| 586 | auto src = tensors.get_const_tensor(ACL_SRC_0); |
| 587 | auto biases = tensors.get_const_tensor(ACL_SRC_2); |
| 588 | auto dst = tensors.get_tensor(ACL_DST); |
| 589 | auto gemm_input_to_use = src; |
| 590 | auto gemm_output_to_use = dst; |
| 591 | |
| 592 | CLAuxTensorHandler im2col_output(offset_int_vec(Im2ColOutput), _im2col_output, tensors, false); |
| 593 | CLAuxTensorHandler gemm_output(offset_int_vec(GemmOutput), _gemm_output, tensors, false); |
| 594 | CLAuxTensorHandler weights_reshaped(offset_int_vec(WeightsReshaped), _weights_reshaped, tensors, false); |
| 595 | |
| 596 | // Run im2col |
| 597 | if (!_skip_im2col) |
| 598 | { |
| 599 | ITensorPack pack = {{TensorType::ACL_SRC, src}, {TensorType::ACL_DST, im2col_output.get()}}; |
| 600 | CLScheduler::get().enqueue_op(*_im2col_kernel, pack, false); |
| 601 | gemm_input_to_use = im2col_output.get(); |
| 602 | } |
| 603 | if (!_skip_col2im) |
| 604 | { |
| 605 | gemm_output_to_use = gemm_output.get(); |
| 606 | } |
| 607 | ITensorPack pack_mm = tensors; |
| 608 | pack_mm.add_const_tensor(TensorType::ACL_SRC_0, gemm_input_to_use); |
| 609 | pack_mm.add_const_tensor(TensorType::ACL_SRC_1, weights_reshaped.get()); |
| 610 | if (!_append_bias) |
| 611 | { |
| 612 | pack_mm.add_const_tensor(TensorType::ACL_SRC_2, biases); |
| 613 | } |
| 614 | pack_mm.add_tensor(TensorType::ACL_DST, gemm_output_to_use); |
| 615 | // Runs ClGemm or ClGemmLowpMatrixMultiplyCore functions |
| 616 | if (_is_quantized) |
| 617 | { |
| 618 | // Run gemmlowp |
| 619 | _mm_gemmlowp->run(pack_mm); |
| 620 | } |
| 621 | else |
| 622 | { |
| 623 | // Run gemm |
| 624 | _mm_gemm->run(pack_mm); |
| 625 | } |
| 626 | |
| 627 | // Reshape output matrix |
| 628 | if (!_skip_col2im) |
| 629 | { |
| 630 | ITensorPack pack = {{TensorType::ACL_SRC, gemm_output_to_use}, {TensorType::ACL_DST, dst}}; |
| 631 | CLScheduler::get().enqueue_op(*_col2im_kernel.get(), pack, false); |
| 632 | } |
| 633 | |
| 634 | //Run Activation Layer if we cannot fuse in GEMM |
| 635 | if (!_fuse_activation) |
| 636 | { |
| 637 | ITensorPack pack = {{TensorType::ACL_SRC, dst}, {TensorType::ACL_DST, dst}}; |
| 638 | CLScheduler::get().enqueue_op(*_activation_kernel.get(), pack, false); |
| 639 | } |
nothing calls this directly
no test coverage detected