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.

grad_implementations_test.cc 1.5 kB

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. #include <iostream>
  17. #include <memory>
  18. #include <vector>
  19. #include "ir/value.h"
  20. #include "ir/manager.h"
  21. #include "common/common_test.h"
  22. #include "optimizer/ad/dfunctor.h"
  23. #include "debug/draw.h"
  24. #include "common/py_func_graph_fetcher.h"
  25. namespace mindspore {
  26. namespace prim {
  27. class TestGradImplementations : public UT::Common {
  28. public:
  29. TestGradImplementations() {}
  30. virtual void SetUp() {}
  31. };
  32. TEST_F(TestGradImplementations, TestGetAugmentedGraph) {
  33. FuncGraphPtr fg = ad::g_k_prims.KPrimitive(NewValueNode(kPrimScalarMul), nullptr);
  34. ASSERT_TRUE(fg != nullptr);
  35. draw::Draw("gradImpl_TestGetAugmentedFuncGraph.dot", fg);
  36. auto fg1 = ad::g_k_prims.KPrimitive(NewValueNode(kPrimScalarMul), nullptr);
  37. FuncGraphPairMapEquiv equiv_graph;
  38. NodeMapEquiv equiv_node;
  39. ASSERT_TRUE(Isomorphic(fg, fg1, &equiv_graph, &equiv_node));
  40. }
  41. } // namespace prim
  42. } // namespace mindspore