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.

cc_implementations.h 2.3 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * Copyright 2019 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_CCSRC_OPERATOR_CC_IMPLEMENTATIONS_H_
  17. #define MINDSPORE_CCSRC_OPERATOR_CC_IMPLEMENTATIONS_H_
  18. #include <vector>
  19. #include <memory>
  20. #include "ir/anf.h"
  21. #include "ir/value.h"
  22. #include "utils/any.h"
  23. namespace mindspore {
  24. // namespace to support primitive operators definition
  25. namespace prim {
  26. using Any = mindspore::Any;
  27. using AnyPtrList = std::vector<std::shared_ptr<Any>>;
  28. using ValuePtrList = std::vector<ValuePtr>;
  29. using OpsFunction = std::function<Any(const AnyPtrList &)>;
  30. using AnfNodeOpsFunction = std::function<AnfNodePtr(const std::vector<AnfNodePtr> &)>;
  31. ValuePtr ScalarAdd(const ValuePtrList &list);
  32. ValuePtr ScalarSub(const ValuePtrList &list);
  33. ValuePtr ScalarMul(const ValuePtrList &list);
  34. ValuePtr ScalarDiv(const ValuePtrList &list);
  35. ValuePtr ScalarMod(const ValuePtrList &list);
  36. ValuePtr ScalarPow(const ValuePtrList &list);
  37. ValuePtr ScalarFloordiv(const ValuePtrList &list);
  38. ValuePtr ScalarUAdd(const ValuePtrList &list);
  39. ValuePtr ScalarUSub(const ValuePtrList &list);
  40. ValuePtr ScalarLog(const ValuePtrList &list);
  41. ValuePtr ScalarEq(const ValuePtrList &list);
  42. ValuePtr ScalarLt(const ValuePtrList &list);
  43. ValuePtr ScalarGt(const ValuePtrList &list);
  44. ValuePtr ScalarNe(const ValuePtrList &list);
  45. ValuePtr ScalarLe(const ValuePtrList &list);
  46. ValuePtr ScalarGe(const ValuePtrList &list);
  47. ValuePtr BoolNot(const ValuePtrList &list);
  48. ValuePtr BoolAnd(const ValuePtrList &list);
  49. ValuePtr BoolOr(const ValuePtrList &list);
  50. ValuePtr BoolEq(const ValuePtrList &list);
  51. std::vector<int> BroadcastShape_(std::vector<int> s1, std::vector<int> s2);
  52. } // namespace prim
  53. } // namespace mindspore
  54. #endif // MINDSPORE_CCSRC_OPERATOR_CC_IMPLEMENTATIONS_H_