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.

arithmetic_common.h 2.1 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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_ARITHMETIC_COMMON_H_
  17. #define MINDSPORE_LITE_NNACL_ARITHMETIC_COMMON_H_
  18. #ifdef ENABLE_NEON
  19. #include <arm_neon.h>
  20. #endif
  21. #include <string.h>
  22. #include "nnacl/op_base.h"
  23. #include "nnacl/arithmetic_common.h"
  24. typedef struct ArithmeticParameter {
  25. OpParameter op_parameter_;
  26. bool broadcasting_;
  27. size_t ndim_;
  28. int activation_type_;
  29. int in_shape0_[10];
  30. int in_elements_num0_;
  31. int in_shape1_[10];
  32. int in_elements_num1_;
  33. int out_shape_[10];
  34. int out_elements_num_;
  35. int in_strides0_[10];
  36. int in_strides1_[10];
  37. int out_strides_[10];
  38. int multiples0_[10];
  39. int multiples1_[10];
  40. } ArithmeticParameter;
  41. #ifdef __cplusplus
  42. extern "C" {
  43. #endif
  44. void TileOneDimension(float *inData, float *outData, int dim, size_t ndim, int *inShape, int *inStrides,
  45. int *outStrides, int *multiple);
  46. void ComputeStrides(int *shape, int *strides, int ndim);
  47. void CalcMultiplesAndStrides(ArithmeticParameter *param);
  48. void TileDimensions(float *data0, float *data1, float *tile_data0, float *tile_data1, ArithmeticParameter *param);
  49. void TileDimensionsUint8(uint8_t *data0, uint8_t *data1, uint8_t *tile_data0, uint8_t *tile_data1,
  50. ArithmeticParameter *param);
  51. void TileDimensionsInt8(int8_t *data0, int8_t *data1, int8_t *tile_data0, int8_t *tile_data1,
  52. ArithmeticParameter *param);
  53. #ifdef __cplusplus
  54. }
  55. #endif
  56. #endif // MINDSPORE_LITE_NNACL_ARITHMETIC_COMMON_H_