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.

node.py 2.0 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # Copyright 2021 Huawei Technologies Co., Ltd
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # ==============================================================================
  15. """Node in the computational graph."""
  16. from abc import ABC
  17. class Node(ABC):
  18. """Node in the computational graph."""
  19. @property
  20. def name(self):
  21. """
  22. Get the full name of this node.
  23. Returns:
  24. str, the full name of the node.
  25. """
  26. return ""
  27. @property
  28. def stack(self):
  29. """Get stack info."""
  30. return None
  31. def get_input_tensors(
  32. self,
  33. iterations=None,
  34. ranks=None,
  35. slots=None):
  36. """
  37. Get the input tensors of the node.
  38. Returns:
  39. Iterable[DebuggerTensor], the input tensors of the node.
  40. """
  41. def get_output_tensors(
  42. self,
  43. iterations=None,
  44. ranks=None,
  45. slots=None):
  46. """
  47. Get the output tensors of this node.
  48. Returns:
  49. Iterable[DebuggerTensor], the output tensors of the node.
  50. """
  51. def get_input_nodes(self):
  52. """
  53. Get the input nodes of this node.
  54. Returns:
  55. Iterable[Node], the input nodes of this node.
  56. """
  57. def get_output_nodes(self):
  58. """
  59. Get the nodes that use the output tensors of this node.
  60. Returns:
  61. Iterable[Node], the output nodes of this node.
  62. """