• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2020-2022 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/base/fill_base.h"
18 #include "nnacl/fill_base_simd.h"
19 
FillFp32(float * output,int size,float data)20 int FillFp32(float *output, int size, float data) {
21   if (output == NULL) {
22     return NNACL_NULL_PTR;
23   }
24 
25   int index = 0;
26 
27   SIMD_RUN_NO_SCALAR(FillFp32, index, output, size, data);
28 
29   for (; index < size; ++index) {
30     output[index] = data;
31   }
32   return NNACL_OK;
33 }
34 
FillInt32(int * output,int size,int data)35 int FillInt32(int *output, int size, int data) {
36   if (output == NULL) {
37     return NNACL_NULL_PTR;
38   }
39 
40   int index = 0;
41 
42   SIMD_RUN_NO_SCALAR(FillInt32, index, output, size, data);
43 
44   for (; index < size; ++index) {
45     output[index] = data;
46   }
47   return NNACL_OK;
48 }
49 
FillBool(bool * output,int size,bool data)50 int FillBool(bool *output, int size, bool data) {
51   if (output == NULL) {
52     return NNACL_NULL_PTR;
53   }
54 
55   for (int index = 0; index < size; ++index) {
56     output[index] = data;
57   }
58   return NNACL_OK;
59 }
60