You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

layer_norm_parameter.h 1.5 kB

5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /**
  2. * Copyright 2020 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_LITE_NNACL_LAYER_NORM_PARAMETER_H_
  17. #define MINDSPORE_LITE_NNACL_LAYER_NORM_PARAMETER_H_
  18. #include "nnacl/op_base.h"
  19. #include "mindspore/lite/nnacl/int8/quantize.h"
  20. enum ElementwiseMode { ELEMENTWISE_NOT = 0, ELEMENTWISE_PER_CHANNEL = 1, ELEMENTWISE_PER_NUM = 2 };
  21. typedef struct LayerNormParameter {
  22. // Primitive parameter
  23. OpParameter op_parameter_;
  24. float epsilon_;
  25. int begin_norm_axis_;
  26. int begin_params_axis_;
  27. // shape correlative
  28. int norm_inner_size_;
  29. int norm_outer_size_;
  30. int params_inner_size_;
  31. int params_outer_size_;
  32. int normalized_dims_;
  33. int normalized_shape_[MAX_SHAPE_SIZE];
  34. // other parameter
  35. int thread_count_;
  36. int thread_outsize_;
  37. } LayerNormParameter;
  38. typedef struct LayerNormQuantArg {
  39. int32_t in_zp_;
  40. int32_t out_zp_;
  41. double in_scale_;
  42. double out_scale_;
  43. } LayerNormQuantArg;
  44. #endif // MINDSPORE_LITE_NNACL_LAYER_NORM_PARAMETER_H_