• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef MINDSPORE_NNACL_FP32_INSTANCE_NORM_H_
17 #define MINDSPORE_NNACL_FP32_INSTANCE_NORM_H_
18 
19 #include "nnacl/op_base.h"
20 #include "nnacl/instance_norm_parameter.h"
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #define MS_ADDQ_F32_VEC(in1, in2, in3, in4, v1, v2, v3, v4) \
27   in1 = MS_ADDQ_F32(in1, v1);                               \
28   in2 = MS_ADDQ_F32(in2, v2);                               \
29   in3 = MS_ADDQ_F32(in3, v3);                               \
30   in4 = MS_ADDQ_F32(in4, v4);
31 
32 #define MS_DIVQ_F32_VEC(in1, in2, in3, in4, v) \
33   in1 = MS_DIVQ_F32(in1, v);                   \
34   in2 = MS_DIVQ_F32(in2, v);                   \
35   in3 = MS_DIVQ_F32(in3, v);                   \
36   in4 = MS_DIVQ_F32(in4, v);
37 
38 int InstanceNorm(const float *src_data, float *dst_data, const float *gamma_data, const float *beta_data,
39                  const InstanceNormParameter *param, size_t task_id);
40 int InstanceNormNC4HW4(const float *src_data, float *dst_data, const float *gamma_data, const float *beta_data,
41                        const InstanceNormParameter *param, size_t task_id);
42 #ifdef ENABLE_AVX
43 int InstanceNormNC8HW8(const float *src_data, float *dst_data, const float *gamma_data, const float *beta_data,
44                        const InstanceNormParameter *param, size_t task_id);
45 #endif
46 #ifdef __cplusplus
47 }
48 #endif
49 
50 #endif  // MINDSPORE_NNACL_FP32_INSTANCE_NORM_H_
51