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.

ops.h 1.9 kB

4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. * Copyright 2019-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_CCSRC_FRONTEND_OPERATOR_OPS_H_
  17. #define MINDSPORE_CCSRC_FRONTEND_OPERATOR_OPS_H_
  18. #include <iostream>
  19. #include <string>
  20. #include <memory>
  21. #include "ir/anf.h"
  22. #include "ir/primitive.h"
  23. #include "base/core_ops.h"
  24. namespace mindspore {
  25. // namespace to support primitive operators
  26. namespace prim {
  27. ValuePtr GetPythonOps(const std::string &op_name,
  28. const std::string &module_name = "mindspore._extends.parse.standard_method",
  29. bool use_signature = false);
  30. class UnpackGraphPrimitive : public Primitive {
  31. public:
  32. explicit UnpackGraphPrimitive(const std::string &name, const bool &with_sens, const bool &need_unpack_args)
  33. : Primitive("UnpackGraph"), name_(name), with_sens_in_args_(with_sens), need_unpack_args_(need_unpack_args) {}
  34. ~UnpackGraphPrimitive() override = default;
  35. MS_DECLARE_PARENT(UnpackGraphPrimitive, Primitive)
  36. bool with_sens_in_args() const { return with_sens_in_args_; }
  37. bool need_unpack_args() const { return need_unpack_args_; }
  38. private:
  39. std::string name_;
  40. bool with_sens_in_args_;
  41. bool need_unpack_args_;
  42. };
  43. using UnpackGraphPrimitivePtr = std::shared_ptr<UnpackGraphPrimitive>;
  44. } // namespace prim
  45. } // namespace mindspore
  46. #endif // MINDSPORE_CCSRC_FRONTEND_OPERATOR_OPS_H_