1 /**
2 * Copyright 2021 Huawei Technologies Co., Ltd
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #include "nnacl/fp32/splice_fp32.h"
SpliceFp32(const float * src_data,int src_row,int src_col,const SpliceParameter * splice_parameter,float * dst_data,int dst_row,int dst_col)18 void SpliceFp32(const float *src_data, int src_row, int src_col, const SpliceParameter *splice_parameter,
19 float *dst_data, int dst_row, int dst_col) {
20 int forward_index = 0;
21 for (int r = 0; r < dst_row; ++r) {
22 float *dst_row_data = dst_data + r * dst_col;
23 for (int off = 0; off < splice_parameter->context_dim_; ++off) {
24 int r_off = splice_parameter->forward_indexes_[forward_index];
25 forward_index++;
26 const float *tmp_src_data = src_data + r_off * src_col;
27 float *tmp_dst_data = dst_row_data + off * src_col;
28 memcpy(tmp_dst_data, tmp_src_data, (size_t)(src_col) * sizeof(float));
29 }
30 }
31 }
32