ONE - On-device Neural Engine
Loading...
Searching...
No Matches
TopologicalSortHelper.TopologicalSortHelper Class Reference

Public Member Functions

 __init__ (self, vertices)
 
 add_edge (self, u, v)
 
 sort_util (self, v, visited, stack)
 
 sort (self)
 

Data Fields

 graph
 
 vertices
 

Detailed Description

Definition at line 20 of file TopologicalSortHelper.py.

Constructor & Destructor Documentation

◆ __init__()

TopologicalSortHelper.TopologicalSortHelper.__init__ (   self,
  vertices 
)

Definition at line 21 of file TopologicalSortHelper.py.

21 def __init__(self, vertices):
22 self.graph = defaultdict(list)
23 self.vertices = vertices
24

Member Function Documentation

◆ add_edge()

TopologicalSortHelper.TopologicalSortHelper.add_edge (   self,
  u,
  v 
)

Definition at line 25 of file TopologicalSortHelper.py.

25 def add_edge(self, u, v):
26 self.graph[u].append(v)
27

References tflimport::GraphBuilderContext.graph(), exo::test::TestGraph.graph(), GraphTestcase< GraphCode::Identity >.graph(), GraphTestcase< GraphCode::ConstGen >.graph(), GraphTestcase< GraphCode::Relu >.graph(), GraphTestcase< GraphCode::FeatureCodec >.graph(), GraphTestcase< GraphCode::AvgPool2D >.graph(), GraphTestcase< GraphCode::DepthwiseConv2D >.graph(), GraphTestcase< GraphCode::TransposedConv2D >.graph(), GraphTestcase< GraphCode::MaxPool2D >.graph(), GraphTestcase< GraphCode::TensorConcat >.graph(), GraphTestcase< GraphCode::FixedReshape >.graph(), GraphTestcase< GraphCode::TensorTranspose >.graph(), luci::GraphBuilderContext.graph(), luci::ConstantFoldingTestGraph.graph(), luci::test::TestGraph.graph(), moco::GraphBuilderContext.graph(), nnc::PassData.graph, TopologicalSortHelper.TopologicalSortHelper.graph, moco::onnx::GraphBuilderContext.graph(), onert::backend::ContextData.graph, onert::backend::BackendContext.graph(), onert::ir::train::TrainableGraph.graph(), onert::compiler::ILoweredGraph.graph(), onert::exec::IExecutor.graph(), onert::exec::ExecutorBase.graph(), onert::exec::train::TrainableExecutor.graph(), onert::compiler::LoweredGraph.graph(), onert::compiler::train::LoweredTrainableGraph.graph(), onert::compiler::LoweredGraph.graph(), onert::compiler::train::LoweredTrainableGraph.graph(), onert::compiler::ILoweredGraph.graph(), loco::Node.graph(), loco::NodePool.graph(), luci::Module.graph(), loco::Node.graph(), GraphBuilder::Context.graph(), GraphTestcase< GraphCode::TensorBroadcast >.graph(), exo::ProgressReporter.graph(), fme_apply::ProgressReporter.graph(), loco::Node.graph(), luci::ProgressReporter.graph(), luci::Module.graph(), and moco::tf::ProgressReporter.graph().

◆ sort()

TopologicalSortHelper.TopologicalSortHelper.sort (   self)

Definition at line 37 of file TopologicalSortHelper.py.

37 def sort(self):
38 visited = dict.fromkeys(self.vertices, False)
39 stack = []
40
41 for v in self.vertices:
42 if visited[v] == False:
43 self.sort_util(v, visited, stack)
44
45 return stack

References TopologicalSortHelper.TopologicalSortHelper.sort_util(), and TopologicalSortHelper.TopologicalSortHelper.vertices.

◆ sort_util()

TopologicalSortHelper.TopologicalSortHelper.sort_util (   self,
  v,
  visited,
  stack 
)

Definition at line 28 of file TopologicalSortHelper.py.

28 def sort_util(self, v, visited, stack):
29 visited[v] = True
30
31 for i in self.graph[v]:
32 if visited[i] == False:
33 self.sort_util(i, visited, stack)
34
35 stack.insert(0, v)
36

References tflimport::GraphBuilderContext.graph(), exo::test::TestGraph.graph(), GraphTestcase< GraphCode::Identity >.graph(), GraphTestcase< GraphCode::ConstGen >.graph(), GraphTestcase< GraphCode::Relu >.graph(), GraphTestcase< GraphCode::FeatureCodec >.graph(), GraphTestcase< GraphCode::AvgPool2D >.graph(), GraphTestcase< GraphCode::DepthwiseConv2D >.graph(), GraphTestcase< GraphCode::TransposedConv2D >.graph(), GraphTestcase< GraphCode::MaxPool2D >.graph(), GraphTestcase< GraphCode::TensorConcat >.graph(), GraphTestcase< GraphCode::FixedReshape >.graph(), GraphTestcase< GraphCode::TensorTranspose >.graph(), luci::GraphBuilderContext.graph(), luci::ConstantFoldingTestGraph.graph(), luci::test::TestGraph.graph(), moco::GraphBuilderContext.graph(), nnc::PassData.graph, TopologicalSortHelper.TopologicalSortHelper.graph, moco::onnx::GraphBuilderContext.graph(), onert::backend::ContextData.graph, onert::backend::BackendContext.graph(), onert::ir::train::TrainableGraph.graph(), onert::compiler::ILoweredGraph.graph(), onert::exec::IExecutor.graph(), onert::exec::ExecutorBase.graph(), onert::exec::train::TrainableExecutor.graph(), onert::compiler::LoweredGraph.graph(), onert::compiler::train::LoweredTrainableGraph.graph(), onert::compiler::LoweredGraph.graph(), onert::compiler::train::LoweredTrainableGraph.graph(), onert::compiler::ILoweredGraph.graph(), loco::Node.graph(), loco::NodePool.graph(), luci::Module.graph(), loco::Node.graph(), GraphBuilder::Context.graph(), GraphTestcase< GraphCode::TensorBroadcast >.graph(), exo::ProgressReporter.graph(), fme_apply::ProgressReporter.graph(), loco::Node.graph(), luci::ProgressReporter.graph(), luci::Module.graph(), moco::tf::ProgressReporter.graph(), and TopologicalSortHelper.TopologicalSortHelper.sort_util().

Referenced by TopologicalSortHelper.TopologicalSortHelper.sort(), and TopologicalSortHelper.TopologicalSortHelper.sort_util().

Field Documentation

◆ graph

TopologicalSortHelper.TopologicalSortHelper.graph

◆ vertices

TopologicalSortHelper.TopologicalSortHelper.vertices

The documentation for this class was generated from the following file: