session

@startuml
class SessionBasic {
Init(uint32_t device_id)
GraphId CompileGraph(const AnfNodePtrList &lst, const AnfNodePtrList &outputs)
GraphId CompileGraph(NotNull func_graph)
BuildGraph(GraphId)
RunGraph(const GraphId &graph_id, const std::vector &inputs, VectorRef *outputs)
BuildOp(const OpRunInfo &, const GraphInfo &, const std::vector &input_tensors,
const std::vector &tensors_mask)

  py::tuple RunOp(const OpRunInfo &, const GraphInfo &, const std::vector &input_tensors)
  RegisterSummaryCallBackFunc(const CallBackFunc &callback)
  CreateCNodeKernelGraph(const AnfNodePtr node, KernelGraphPtr graph)
  shared_ptr ConstructKernelGraph(const AnfNodePtrList &lst, const AnfNodePtrList &outputs)
  shared_ptr ConstructKernelGraph(const FuncGraphPtr &func_graph,
                                                    std::vector *all_out_graph)
  CNodePtr CreateNewCNode(const CNodePtr &cnode, bool valid_input, KernelGraph *graph, bool *from_other_graph,
                          std::unordered_map *other_graph_cnode)
  CNodePtr CreateNewCNode(const CNodePtr &cnode, KernelGraph *graph)
  GraphId SetFinalGraphInput(const std::vector &)
  void SetFinalGraphOutput(const BaseRef &)
  SwitchCompile(GraphId, GraphId, GraphId, const AnfNodePtr &) 
  SetChildGraphInput(GraphId, const VectorRef &)
  GraphId GetGraphIdByNode(const AnfNodePtr &) const
  GraphId GetFinalRunGraph() const
  SetActive(GraphId, GraphId)
  GetSummaryNodes(KernelGraph *graph)

}

class CPUSession {
Init()
CompileGraph()
}

class GPUSession {
Init()
CompileGraph()
RunGraph()
BuildOp()
RunOp()
}

class AscendSession {
Init()
CompileGraph()
RunGraph()
BuildOp()
RunOp()
SetFinalGraphInput
SwitchCompile
SetChildGraphInput
GetGraphIdByNode
GetFinalRunGraph
SetActive
CompileChildGraph
RecurseGetSummaryNodes
GetSummaryNodes
}

interface KernelMod {
GetInputSizeList()
GetOutputSizeList()
GetWorkspaceSizeList()
bool Launch(inputs, workspace,
outputs, stream_ptr)
GenParameters()
}

class GpuKernel {
Init(const CNodePtr &kernel_node)
}

KernelMod <|.. GpuKernel

你可能感兴趣的:(session)