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.

spliter.cc 1.7 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. * Copyright 2021 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 "tools/optimizer/parallel/spliter.h"
  17. namespace mindspore {
  18. namespace opt {
  19. Spliter *Spliter::GetInstance() {
  20. static Spliter spliter;
  21. return &spliter;
  22. }
  23. void Spliter::UpdateNodeOutputs(const std::string &input_node_name, const AnfNodePtr &candidate_output) {
  24. if (graph_node_outputs_.find(input_node_name) != graph_node_outputs_.end()) {
  25. std::vector<AnfNodePtr>::iterator it;
  26. it =
  27. find(graph_node_outputs_[input_node_name].begin(), graph_node_outputs_[input_node_name].end(), candidate_output);
  28. if (it != graph_node_outputs_[input_node_name].end()) {
  29. return;
  30. }
  31. }
  32. graph_node_outputs_[input_node_name].push_back(candidate_output);
  33. }
  34. void Spliter::UpdateNodeInputShapes(const std::string &node_name, const std::vector<ShapeVector> &input_shapes) {
  35. graph_node_input_shapes_[node_name] = (input_shapes);
  36. }
  37. void Spliter::UpdateNodeOutputShapes(const std::string &node_name, const std::vector<ShapeVector> &output_shapes) {
  38. graph_node_output_shapes_[node_name] = (output_shapes);
  39. }
  40. } // namespace opt
  41. } // namespace mindspore